Re: hexadecimal from byte?

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Thu, 17 Jan 2008 16:36:25 -0700

ncl 0> s = "12"
ncl 1> print(stringtointeger(s))
ncl 2> print(int2byte(stringtointeger(s)))

get you hex

Andrea Hahmann wrote:
> Hi Adam
>
> What you suggests just gives be the number 2 as a string "2". What I
> need is the hexadecimal representation of the number 2. For example,
> the number 123 is "01111011". In my case each of these "0/1"
> represent when a given test has been passed or not. That is the
> information I need. Any suggestions?
>
> Thanks
> Andrea
>
> asphilli_at_ucar.edu wrote:
>> Hi Andrea,
>>
>> The conversion is done automatically behind-the-scenes in most cases.
>> For
>> instance:
>>
>> a = 2
>> b = "Quantity needed: "+a
>> printVarSummary(b)
>> print(b)
>>
>> or
>> a = 2
>> b = "Hello"
>> b = a
>> print(b)
>>
>> Adam
>>
>>
>>> Reading the documentation, I have found that I can convert an
>>> hexadecimal number to integer using the function "stringtointeger". Is
>>> there a function to do the conversion back? If not, perhaps somebody
>>> has already written such a thing?
>>>
>>> Thanks,
>>> Andrea
>>>
>>> --
>>> ----------------------------------------------------------------
>>> Andrea N. Hahmann, Ph.D.
>>> Research Applications Laboratory
>>> Natl. Center for Atmospheric Research Phone: 1-303-497-8383
>>> PO BOX 3000 Fax: 1-303-497-8401
>>> Boulder, CO 80301 hahmann_at_ucar.edu
>>> ----------------------------------------------------------------
>>>
>>>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> ncl-talk_at_ucar.edu
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>>>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk_at_ucar.edu
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>

-- 
======================================================
Dennis J. Shea                  tel: 303-497-1361    |
P.O. Box 3000                   fax: 303-497-1333    |
Climate Analysis Section                             |
Climate & Global Dynamics Div.                       |
National Center for Atmospheric Research             |
Boulder, CO  80307                                   |
USA                        email: shea 'at' ucar.edu |
======================================================
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Jan 17 2008 - 16:36:25 MST

This archive was generated by hypermail 2.2.0 : Wed Jan 23 2008 - 14:19:33 MST