473,831 Members | 2,263 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How To Append Trailing Zeros

for example:
A1 = 123
A1=123000 <- final result

A1 =1234
A1=123400<- final result

A1=1
A1=100000<-final result

How do i append trailing zero? is there a function that i
can use for this?
i cannot use format(A1,"0000 00") because it append zero in
front.
Nov 22 '05 #1
2 1794
Keali wrote:
for example:
A1 = 123
A1=123000 <- final result

A1 =1234
A1=123400<- final result

A1=1
A1=100000<-final result

How do i append trailing zero? is there a function that i
can use for this?
i cannot use format(A1,"0000 00") because it append zero in
front.


What is A1? If it is a string, look at PadRight(int, char).

--
Tom Porterfield
MS-MVP MCE
http://support.telop.org

Please post all follow-ups to the newsgroup only.
Nov 22 '05 #2
Keali <ke*******@fast mail.fm> wrote:
for example:
A1 = 123
A1=123000 <- final result

A1 =1234
A1=123400<- final result

A1=1
A1=100000<-final result

How do i append trailing zero? is there a function that i
can use for this?
i cannot use format(A1,"0000 00") because it append zero in
front.


Use a1 = a1.PadRight(6, '0');

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 22 '05 #3

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

Similar topics

1
3278
by: BARBARA FLOYD | last post by:
Hi, I have an ASP file which is opened in MS Excel. I have used the "formatNumber" function to set the number of decimals for variables which are displayed. however Excel cuts off any zeros at the end. e.g 4.650 displays as 4.65 the number of decimals I want to display to varies across the page, e.g. I cant say "display the whole with 3
5
15482
by: Jason | last post by:
I have a column defined as DECIMAL(10,6). I want to display it as a string but I do not want the trailing zeros. I cannot seem to get CAST or CONVERT or STR to exclude the zeros. Examples: 45.340000 --> 45.34 27.700000 --> 27.7 55.000000 --> 55 Is there a function that will do this or do I need to write my own?
2
382
by: Keali | last post by:
for example: A1 = 123 A1=123000 <- final result A1 =1234 A1=123400<- final result A1=1 A1=100000<-final result
2
2208
by: John Baker | last post by:
Hi: I have a situation where I am appending records to a table, and some of the records do NOT have all the fields in them that the table has. In those cases, the field is filled with a null but the normal append process. Does anyone know of an easy way to force the use of a 0 (zero) rather than a null when fields don't match on an append? It would make life much easier down the line where I haver to do summing and things, and sometimes...
3
11199
by: V. Jenks | last post by:
I need to store money values in C# and I noticed when using a float, the trailing zero was trimmed off automatically. I don't want this, is there a native type that will *not* do this so I can have my trailing zeros? I want $0.10 not $0.1.....obviously that gives me serious data issues. Thanks!
15
20105
by: Bob | last post by:
I'm about to convert to string and use regex, but I thought there must be something I'm missing here that already exists. Bob
3
7999
by: keali | last post by:
for example: A1 = 123 A1=123000 <- final result A1 =1234 A1=123400<- final result A1=1 A1=100000<-final result
9
8660
by: Chester | last post by:
I'm working on an app that records data collected by service technicians (VB.Net front-end, SQL Server 2000 back end). The technicians need to record numbers with varying scale and precision. For example, they may record one reading as 63.45 and the next as 123.1 and a third as 1.32456. That's fine - those can be saved as floating point numbers (very little math is done with these numbers so I'm not too worried about strange floating...
4
1853
by: snooglets7 | last post by:
Hey there, I need to store the trailing zeros when I convert a numerical string into a double...I jsut don't know how. I.E. txtLimDist.text = 10.00 (user enters this in the GUI) This gets converted to a double
6
7769
by: JimmyKoolPantz | last post by:
Task: Customer wants a script of the data that was processed in a "CSV" file. Problem: Zip-Code leading zeros are dropped Basically we have a client that has requested a custom script for each file that he has us process. He wants this in a Comma Delimited Format.
0
9793
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9642
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10777
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10208
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9317
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7748
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5785
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3964
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3076
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.