Character
GreyBox Tim
Posts: 60
I'm interested to see if anyone already has the code for grabbing a character from a variable·like the "DIG" function in Pbasic.
i.e.: if I want to grab character "0" of 255 I would put it "var DIG 0" and be replied with the character "5"
Thoughts?
-Tim
i.e.: if I want to grab character "0" of 255 I would put it "var DIG 0" and be replied with the character "5"
Thoughts?
-Tim
Comments
' Use: theDigit = DIG value, whichPos
DIG:
· temp1 = __PARAM1·········· ··' save value
· temp2 = __PARAM2·········· ··' position
· temp3 = 0
· IF temp2 < 3 THEN
··· DO WHILE temp2 > 0
····· temp1 = temp1 / 10
····· DEC temp2·
··· LOOP
··· temp3 = temp1 // 10···
· ENDIF
· RETURN temp3
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
I'll give it a whirl tonigt when I get home - speaking of which, what are you still doing working ths late? I thought I was the only guy staying till 9PM these days...
Cheers!
-Tim
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Again Thanks!
-Tim
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
-Tim