|
-
Dec 11th, 2005, 10:12 PM
#1
Thread Starter
Fanatic Member
How can one number equal 2 in LEN function???(resolved)
Hello all,
This is the dumbest thing i've ever seen. I'm trying to see if a number's length is 1 or 2, and doing something from that, but it is messed up.
Look at my attached screen shots, it says "7" in the LEN function = 2
What the heck??
Last edited by paralinx; Dec 11th, 2005 at 11:13 PM.
-
Dec 11th, 2005, 10:18 PM
#2
Lively Member
Re: How can one number equal 2 in LEN function???
i believe the extra is the space that comes before the number that accomodates the negative sign... but i could be wrong
-
Dec 11th, 2005, 10:18 PM
#3
Re: How can one number equal 2 in LEN function???
Its because what they are dimmed as, a long will return 4 with len. You should wrap it in cstr
len(cstr(seconds))
-
Dec 11th, 2005, 10:19 PM
#4
Fanatic Member
Re: How can one number equal 2 in LEN function???
What are minutes and seconds declared as ? Integers? or strings?
-
Dec 11th, 2005, 10:21 PM
#5
Thread Starter
Fanatic Member
Re: How can one number equal 2 in LEN function???
 Originally Posted by Jumpercables
What are minutes and seconds declared as ? Integers? or strings?
integers
-
Dec 11th, 2005, 10:24 PM
#6
Thread Starter
Fanatic Member
Re: How can one number equal 2 in LEN function???
 Originally Posted by |2eM!x
Its because what they are dimmed as, a long will return 4 with len. You should wrap it in cstr
len(cstr(seconds))

great man, works!
-
Dec 11th, 2005, 10:24 PM
#7
Fanatic Member
Re: How can one number equal 2 in LEN function???
Well it might be possible that there is an extra "thing" added onto the minutes/seconds when you are doing a calculation between a String (from text box) and Integer values.
-
Dec 11th, 2005, 10:33 PM
#8
Re: How can one number equal 2 in LEN function???
In this case Len() is converting the number and returning the number of bytes.
An Iteger/Boolean = 2 Bytes
A Long/Single = 4 Bytes
That is what you are seeing.
The CStr() (as Remix pointed out) is required as the Len() parameter is a String Data Type.
See also LenB() - (Length of String orvaraible in Bytes).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|