[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: constructing a string from hex value

Berger, Daniel

9/6/2006 2:26:00 PM

> -----Original Message-----
> From: Srdjan Marinovic [mailto:srdjan.marinovic@gmail.com]
> Sent: Wednesday, September 06, 2006 8:05 AM
> To: ruby-talk ML
> Subject: constructing a string from hex value
>
>
> hi,
>
> How do I construct a string out of hex values?
> In other words I want to give exact hex value for each byte
> in the string. So I would have soemthing like
>
> 0x2a, 0x7e, 0x0a, 0x7e
>
> If I go through Fixnum I get my string to contain numbers 48,
> 115, 10, 115 but I do not want that but rather a string of
> ASCII(48), ACII(115),...
>
> Thanks
>
> srdjan

[0x2a, 0x7e, 0x0a, 0x7e].pack("C*") => "*~\n~"

Regards,

Dan


This communication is the property of Qwest and may contain confidential or
privileged information. Unauthorized use of this communication is strictly
prohibited and may be unlawful. If you have received this communication
in error, please immediately notify the sender by reply e-mail and destroy
all copies of the communication and any attachments.