|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now! |
|
#1
|
||||
|
||||
|
Ruby Equivalent to Python's Struct
Is there a Ruby equivalent to the pack and/or unpack methods of Python's struct module?
|
|
#2
|
||||
|
||||
|
Yes, it is a method of the Array class, so you get in on any array instance by default.
a = [65, 66, 67] b = a.pack("ccc") Similarly, the unpack() method is part of the String class, so you'll get it by default on any string instance.
__________________
Up the Irons What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home. "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest Down with Sharon Osbourne Puzzle of the Month solved by sizeablegrin, etienne141 and L7Sqr, superior C/C++ programmers of the month |
|
#3
|
||||
|
||||
|
Awesome. Thank you very much, Scorpions.
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Ruby Programming > Ruby Equivalent to Python's Struct |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|