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??
Printable View
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??
i believe the extra is the space that comes before the number that accomodates the negative sign... but i could be wrong
Its because what they are dimmed as, a long will return 4 with len. You should wrap it in cstr
len(cstr(seconds))
:wave:
What are minutes and seconds declared as ? Integers? or strings?
integersQuote:
Originally Posted by Jumpercables
great man, works! :thumb:Quote:
Originally Posted by |2eM!x
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.
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).