formattting numerics

B

Brent Burkart

I need to produce a text file that contains information in certain places.
In other words position 5-10 needs to be a numeric with the last three
places being ".00" If it is zero then it needs to be "0.00".

How do I format my input to handle this and surpress leading zeros?

Thanks,
Brent
 
F

Fergus Cooney

Hi Brent,

At the risk of sounding boring, I'll repeat what I gave you last time.

Formatting of values and strings is powerful in VB.NET. It's very worthwhile
learning how these string formats work.

Take a look at these topics in MSDN.

String.Format
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/fr
lrfsystemstringclassformattopic1.asp

Formatting Overview
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/
cpconformattingoverview.asp

Regards,
Fergus
 
H

Herfried K. Wagner [MVP]

* "Brent Burkart said:
I need to produce a text file that contains information in certain places.
In other words position 5-10 needs to be a numeric with the last three
places being ".00" If it is zero then it needs to be "0.00".

How do I format my input to handle this and surpress leading zeros?

'Format(<expression>, "0.00")'.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top