Convert string to number
Archiver
Posts: 46,084
Does anyone know an easy way to convert from a number represented as
2 ascii characters into the actual number that represents in decimal.
Thanks.
2 ascii characters into the actual number that represents in decimal.
Thanks.
Comments
character to get its decimal value. If you have a two digit value, you
can do it like this:
myVal = 10 * (char10 - "0")
myVal = myVal + (char01 - "0")
... where char10 is the 10's digit character and char01 is the 1's digit
character.
-- Jon Williams
-- Applications Engineer, Parallax
-- Dallas Office
Original Message
From: dangerduckula [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=f_fgKPmvTr1Pwz2SazJ8tXFRis8gyL7GI2rEoxJSv3MR9coGA93vi97-IlS9At4qJHNvBqafSrkjZNBqrn_ngQ]countduckula@o...[/url
Sent: Tuesday, January 20, 2004 9:30 AM
To: basicstamps@yahoogroups.com
Subject: [noparse][[/noparse]basicstamps] Convert string to number
Does anyone know an easy way to convert from a number represented as
2 ascii characters into the actual number that represents in decimal.
Thanks.
If you're receiving these ASCII characters serially, you should use the
SERIN conversion modifier DEC2. I hope this helps.
Best regards,
Russell Warburton
email: russell@w...
website: http://www.warburtech.com
telephone: +44 (0)7814 044 754
Original Message
From: "dangerduckula" <countduckula@o...>
To: <basicstamps@yahoogroups.com>
Sent: Tuesday, January 20, 2004 3:30 PM
Subject: [noparse][[/noparse]basicstamps] Convert string to number
> Does anyone know an easy way to convert from a number represented as
> 2 ascii characters into the actual number that represents in decimal.
>
> Thanks.
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the Subject and
Body of the message will be ignored.
>
>
> Yahoo! Groups Links
>
> To visit your group on the web, go to:
> http://groups.yahoo.com/group/basicstamps/
>
> To unsubscribe from this group, send an email to:
> basicstamps-unsubscribe@yahoogroups.com
>
> Your use of Yahoo! Groups is subject to:
> http://docs.yahoo.com/info/terms/
>
>
>