473,396 Members | 1,929 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Lpad & Rpad

Roy
Hi All,
I have a application which reads from a dat file.I import this into
the database.While exporting this back I want to format the data so
that the alignment is proper.
I have the data in decimals which have to be padded with 0 either to
right or left depending on the digits.((totals to 13 digits)

For some the data is like 58049.859 which is to be padded to make it
as 58049.859000(totally 13 digits)
Some are like 49.859 which is then to be padded as 00049.859000 or
9.85 to be padded as 00009.8500000.
I hope you can understand what I am trying to do here.
As the data is inconsistent,I am not sure how to do this.
I am able to do the padding for a regular number(without decimals) but
confused to do the same for decimals.

Thanks for any help.

Roy
Dec 5 '07 #1
3 11071
Roy <pr********@yahoo.comwrote in news:3d80a555-1f00-4eb0-932f-
cd**********@y5g2000hsf.googlegroups.com:
49.859
Debug.Print Format(49.859, "0000000000.0000000000")

0000000049.8590000000

You could decide how many zeroes.
Dec 5 '07 #2
On Wed, 5 Dec 2007 13:11:19 -0800 (PST), Roy <pr********@yahoo.com>
wrote:
>Hi All,
I have a application which reads from a dat file.I import this into
the database.While exporting this back I want to format the data so
that the alignment is proper.
I have the data in decimals which have to be padded with 0 either to
right or left depending on the digits.((totals to 13 digits)

For some the data is like 58049.859 which is to be padded to make it
as 58049.859000(totally 13 digits)
Some are like 49.859 which is then to be padded as 00049.859000 or
9.85 to be padded as 00009.8500000.
I hope you can understand what I am trying to do here.
As the data is inconsistent,I am not sure how to do this.
I am able to do the padding for a regular number(without decimals) but
confused to do the same for decimals.

Thanks for any help.

Roy
Above, you say 13 digits, but your examples are all 5.6 (11 digits).
Not sure which you want. Adjust the format string below to suit your
needs:

?format(49.859,"00000.0000000")
00049.8590000

?format(9.85,"00000.0000000")
00009.8500000

You didn't make it entirely clear what you want to do with the
formatted output. (report, form, write to file, ???). Store the data
as numeric then format the output as shown above, when needed.
HTH,
Arch
Dec 5 '07 #3
Roy
On Dec 5, 4:46 pm, Arch <send...@spam.netwrote:
On Wed, 5 Dec 2007 13:11:19 -0800 (PST), Roy <praish1...@yahoo.com>
wrote:


Hi All,
I have a application which reads from a dat file.I import this into
the database.While exporting this back I want to format the data so
that the alignment is proper.
I have the data in decimals which have to be padded with 0 either to
right or left depending on the digits.((totals to 13 digits)
For some the data is like 58049.859 which is to be padded to make it
as 58049.859000(totally 13 digits)
Some are like 49.859 which is then to be padded as 00049.859000 or
9.85 to be padded as 00009.8500000.
I hope you can understand what I am trying to do here.
As the data is inconsistent,I am not sure how to do this.
I am able to do the padding for a regular number(without decimals) but
confused to do the same for decimals.
Thanks for any help.
Roy

Above, you say 13 digits, but your examples are all 5.6 (11 digits).
Not sure which you want. Adjust the format string below to suit your
needs:

?format(49.859,"00000.0000000")
00049.8590000

?format(9.85,"00000.0000000")
00009.8500000

You didn't make it entirely clear what you want to do with the
formatted output. (report, form, write to file, ???). Store the data
as numeric then format the output as shown above, when needed.

HTH,
Arch- Hide quoted text -

- Show quoted text -
lyle and Arch,

Thanks for your solutions.This is to format and then write to a file.

Roy
Dec 6 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: DrTebi | last post by:
Hello, I have the following problem: I used to "encode" my email address within links, in order to avoid (most) email spiders. So I had a link like this: <a...
0
by: Thomas Scheffler | last post by:
Hi, I runned in trouble using XALAN for XSL-Transformation. The following snipplet show what I mean: <a href="http://blah.com/?test=test&amp;test2=test2">Test1&amp;</a> <a...
4
by: johkar | last post by:
When the output method is set to xml, even though I have CDATA around my JavaScript, the operaters of && and < are converted to XML character entities which causes errors in my JavaScript. I know...
11
by: Jeremy | last post by:
How can one stop a browser from converting &amp; to & ? We have a textarea in our system wehre a user can type in some html code and have it saved to the database. When the data is retireved...
14
by: Arne | last post by:
A lot of Firefox users I know, says they have problems with validation where the ampersand sign has to be written as &amp; to be valid. I don't have Firefox my self and don't wont to install it only...
12
by: InvalidLastName | last post by:
We have been used XslTransform. .NET 1.1, for transform XML document, Dataset with xsl to HTML. Some of these html contents contain javascript and links. For example: // javascript if (a &gt; b)...
2
by: techiesekar07 | last post by:
this is an oracle query SUBSTR(LPAD(xxxxx, 8, 0),3,6) Please provide me the db2 query for this....
3
by: Ale | last post by:
can we use Lpad() or Rpad() in insert statement?............. if yes, kindly help me out with the query.....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.