HexToInt?

BlitzMax Forums/BlitzMax Programming/HexToInt?

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.

Skid, I tried that as well originally.

Actually, your code doesnt have an = between i and eachin. Even then, I got this error:

Compile Error:ForEach index variable must be an object.

My buggy version:
Function HexToInt( HexStr$ )
	Local n
	For Local c:Byte=EachIn HexStr.Trim().ToUpper()
		If c>47 And c<58 Then n=(n Shl 4)+c-48 ElseIf c>64 And c<71 Then n=(n Shl 4)+c-55 Else Return n
	Next
	Return n
End Function

Print HexToInt("abcd")
And no, throwing the c variable into the first local decleration doesn't work.