Discussion:
1 does not equal 0000001?
(too old to reply)
Fritz Wuehler
2003-09-15 22:01:31 UTC
Permalink
I can probably figure out a way to do this, but I'm hoping there
is some simple way already out there. I need to read a file of
numbers, but want to treat a 1-digit number differently from a 2-
digit number with the same value but with a leading zero. Same
for 3-digit, 4-digit, etc.

Is there some basic VB function that allows this?
the Wiz
2003-09-15 22:45:18 UTC
Permalink
Post by Fritz Wuehler
I can probably figure out a way to do this, but I'm hoping there
is some simple way already out there. I need to read a file of
numbers, but want to treat a 1-digit number differently from a 2-
digit number with the same value but with a leading zero. Same
for 3-digit, 4-digit, etc.
Is there some basic VB function that allows this?
Read the numbers as strings and use len(x$) and val(x$) to separate 1 from 01
or 000001.
They all have a value of 1, but the lengths are 1, 2, and 6, respectively.


More about me: http://www.jecarter.com/
VB3/VB6/NSBasic Palm/C/ PowerBasic source code: http://www.jecarter.com/programs.html
Drivers for Pablo graphics tablet and JamCam cameras: http://home.earthlink.net/~mwbt/
johnecarter atat mindspring dotdot com. Fix the obvious to reply by email.
fidik
2003-09-16 11:32:33 UTC
Permalink
X$ = STR$ (number) 'this coverts number to characterr string
length = LEN (STR$(number)) 'this will give the length
Post by Fritz Wuehler
I can probably figure out a way to do this, but I'm hoping there
is some simple way already out there. I need to read a file of
numbers, but want to treat a 1-digit number differently from a 2-
digit number with the same value but with a leading zero. Same
for 3-digit, 4-digit, etc.
Is there some basic VB function that allows this?
Loading...