|
Re: Convert String to Hexadecimal Number [message #39397 is a reply to message #39396] |
Tue, 11 May 2004 15:45  |
James Kuyper
Messages: 425 Registered: March 2000
|
Senior Member |
|
|
David Fanning wrote:
> Folks,
>
> I guess I could figure this out, eventually, but it has already
> been a long day, and it's getting longer...
>
> Suppose I have a string, 'e4f3', representing a hexadecimal
> number. Does anyone have a good algorithm for converting
> this to a decimal number? (I mean without having to
> remember any of that 8th grade base8, base16 nonsense.)
reads,'e4f3',data,FORMAT='(Z)'
print,data
|
|
|
Re: Convert String to Hexadecimal Number [message #39398 is a reply to message #39397] |
Tue, 11 May 2004 15:44  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
David Fanning writes:
> I guess I could figure this out, eventually, but it has already
> been a long day, and it's getting longer...
>
> Suppose I have a string, 'e4f3', representing a hexadecimal
> number. Does anyone have a good algorithm for converting
> this to a decimal number? (I mean without having to
> remember any of that 8th grade base8, base16 nonsense.)
Whoa! I came up with this about 5 seconds after I hit
the SEND button. Is this legitimate?
var = 'e4f3'
ok = Execute("test = '" + var + "'x")
Print, test
58611
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|