Get length of a LONG?
eagletalontim
Posts: 1,399
If I have a LONG that totals 12345, how can I get the length of the LONG which would be 5? I am trying to clear the characters after the number is display on an LCD without clearing all the spaces. Sometimes the length will be 2 numbers, sometimes it will be 5 numbers.
Comments
-Phil
length := DecSize(myLong)
Andy
For numbers, I like to right-justify in displayed. I have this bit of code in my serial and LCD objects:
But after the ROM table lookups, interpolations, and division, I wouldn't trust it to be accurate near the power-of-ten boundaries.
-Phil
Sometimes those digits mean something such as 000 where it would be important to know that 3 digits were entered. If this number being displayed is a keypad entry then simply count each digit as it is entered. The other thing is that I am a bit worried about is that you are so worried about clearing the number on the LCD in such a precise manner, what is the problem with clearing 5 digits all the time?
The problem of course with all out answers is that the question in couched in such a narrow context which can only mean a narrow answer, which might just miss the mark.