Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

format number

Status
Not open for further replies.

sabetik

IS-IT--Management
Nov 16, 2003
80
GU
I am new to ASP. I was wonder is there a command to convert the text format number to 2 digit number.
Ex: 5258 need to show 52.60
Right now id am doing like this:

<%=fh4a/100%>

Is there a better and beter way to format the number.

Thanks
Kamran
 
Hi,
google and site seach will give you many results, but as i see you want the number 5258 (or rather 5,258) to be 52.58 ... Perhaps you should keep your way (divide by 100) and then do a simple rounding (?)
 
There are a few another ways that you could use but, for a good answer, it also depends on exactly how the original string will look. For example,

1) Will it always be 4 digits long (e.g could the number ever be as high as 15258 or as low as 525?)?
2) Is the precision of the number always going to be in the same place (e.g. could 5258 aver be 525.8 or will it always be 52.60)
3) Do you want to round to the nearest whold number (e.g. would 5254 become 52.50?)


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
yes it could be longet 4 digits or less than. orignal string look like this: 00026598 which it should convert to 265.98
if it 2554 round to 25.50

Thanks
Kamran
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top