PDA

View Full Version : Isolate chars of 2 digit integer?



kevj
- 14th August 2008, 05:08
It seems like there's a statment that splits the individual characters of an integer into two separate variables.

For example:

MyVar = 45

Make_MyVarCharacter1 = 4
Make_MyVarCharacter2 = 5

I'm splitting numbers for display on a 2 digit LED display. I know I saw the command here on the forum or in the PBP manual - been digging and can't find it.

Thanks!

kevj
- 14th August 2008, 05:14
Doh! Found it. Went right to it right after posting. Figures. For anyone else looking for this....


4.17.7. DIG
DIG returns the value of a decimal digit. Simply tell it the digit number (0
- 4 with 0 being the rightmost digit) you would like the value of, and voila.
B0 = 123 ‘ Set B0 to 123
B1 = B0 DIG 1 ‘ Sets B1 to 2 (digit 1 of
123)