Convert Int to String and back to Int

BlitzMax Forums/BlitzMax Beginners Area/Convert Int to String and back to Int

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Hexadecimal conversions:

val1% = 255
Print "Integer: " + val1%

s$ = Hex(val1%)
Print "Hexadecimal string: " + s$

val2% = Int("$" + s$)
Print "Integer again: " + val2%


This caught me out recently. I was not aware you could convert a '$'-prefaced hex string back into a decimal value using an Int cast. I spent hours writing a hextodec function! It's the little things like this that can save a lot of time if you know about them...