Forum: Ruby from Hex to string

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
C8da03a9f69be8910fa9b16b4db969ed?d=identicon&s=25 unknown (Guest)
on 2006-03-08 10:16
(Received via mailing list)
i have datas like that :

646c6532 00000000 61657674 0000012e 00000000 00000000 0000011c 00000004
00000001 00000000 00000000 00000000 [...]
6c6f6e67 00000004 00000000 66726f6d 70736e20 00000008 00000000 005c0001
3b3b3b3b 2d2d2d2d 54455854 00000006 626d6b6d 3a76


seems to be hex encoded US-ASCII (?)

how to convert that in user readable us-ascii ? (to string)

i now i have the sequence "70736e20" which is "psn "
9539774fe19b5268e39ee6cf3ca19b71?d=identicon&s=25 Mikkel Bruun (Guest)
on 2006-03-08 10:16
(Received via mailing list)
String unpack

http://ruby-doc.org/core/classes/String.src/M001436.html
On Wednesday, March 08, 2006, at 6:13 PM,  wrote:
>how to convert that in user readable us-ascii ? (to string)
>
>i now i have the sequence "70736e20" which is "psn "
>--
>une b�vue
>


Mikkel Bruun

www.strongside.dk    - Football Portal(DK)
nflfeed.helenius.org - Football News(DK)
ting.minline.dk      - Buy Old Stuff!(DK)
97187d7e48d59c178c7af8eaaaa3857c?d=identicon&s=25 Gregor Kopp (Guest)
on 2006-03-08 10:31
(Received via mailing list)
a = String.new
a << "70".hex
puts a

look at http://www.rubycentral.com/book/builtins.html in String


Une bévue schrieb:
C8da03a9f69be8910fa9b16b4db969ed?d=identicon&s=25 unknown (Guest)
on 2006-03-08 10:59
(Received via mailing list)
Mikkel Bruun <devlists-ruby-talk@devlists.com> wrote:

> String unpack
>
> http://ruby-doc.org/core/classes/String.src/M001436.html

thanks !
C8da03a9f69be8910fa9b16b4db969ed?d=identicon&s=25 unknown (Guest)
on 2006-03-08 11:02
(Received via mailing list)
Gregor Kopp <gk@cutcopy.com> wrote:

> a = String.new
> a << "70".hex
> puts a
>
> look at http://www.rubycentral.com/book/builtins.html in String

ok, thanks
This topic is locked and can not be replied to.