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!

Fomratting Numbers!

Status
Not open for further replies.

bomayed

Technical User
May 13, 2002
101
AE
How to format this number : 100343E21 to a normal number in ASP ?

Thank you

 
mmmm, what is 'normal'?

n ="100343E21"
response.write FormatNumber( n , 0)

hth,
Foxbox
 
You need to convert from Hexadecimal values to Decimal.
Code:
Function Hex2Dec(nr) 
   Dim n, i, digit, dec 
   dec = 0 
   n = Len(nr) 
   For i = 1 To n 
      dec = dec * 16 
      digit = Mid(nr, i, 1) 
      dec = dec + InStr("0123456789ABCDEF", digit) - 1 
   Next 
    Hex2Dec = dec
End Function

decval=hex2dec("100343E21")

________
George, M
 
to me 100343E21 is not hexadecimal but 100343 times 10 power 21 (often called 'scientific notation'). So this represents this huge number:

100,343,000,000,000,000,000,000,000

("How many things can go wrong when you fly to Mars?")

hth,
Foxbox
 
I think if you only use
FormatNumber("100343E21") it should do the job then


________
George, M
 
yep, my

n = "100343E21"
response.write FormatNumber( n , 0)

is the same as
response.write FormatNumber( 100343E21 , 0)

is the same as
response.write FormatNumber( 100343E21 )

and with such a number it is crazy to want
response.write FormatNumber( 100343E21 , 6)

[rednose]









hth,
Foxbox
 
Hehehe, I didnt see your Post before, but that was a surprise for me to see FormatNumber displaying Scientific numbers. Never tryed before this.
:)

________
George, M
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top