remove preceding zeroes in ASP

R

Ray at

The easiest way in this case would be to CInt your number.

s = "00000102"
snew = CInt(s)
response.write snew

Ray at work
 
J

JT

how would i transform this number: 00000102 into 102

basically, i just want to remove all preceding zeroes, but not replace all
zeroes
 
T

Tom Kaminski [MVP]

JT said:
how would i transform this number: 00000102 into 102

basically, i just want to remove all preceding zeroes, but not replace all
zeroes

<%
var = CInt("00000102")
%>
 
M

Mark Schupp

you might want to use CLng rather than CInt unless you know that the number
will never be greater than 32k.
 
R

Ray at

Depending on the exact kind of data he anticipates, a totally different
approach may be needed, like of the data will wind up being "0000102A"
"00000102B" and things like that. But I guess we'll see.

Ray at home
 
M

Mark Schupp

well... he did say "number" in his post. whether he meant it or not is
another story.
 

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

Members online

No members online now.

Forum statistics

Threads
474,143
Messages
2,570,821
Members
47,367
Latest member
mahdiharooniir

Latest Threads

Top