Linux heracles.o2switch.net 4.18.0-553.62.1.lve.el8.x86_64 #1 SMP Mon Jul 21 17:50:35 UTC 2025 x86_64
/
opt
/
alt
/
ruby21
/
share
/
ri
/
2.1.0
/
system
/
String
/
//opt/alt/ruby21/share/ri/2.1.0/system/String/unpack-i.ri
U:RDoc::AnyMethod[iI"unpack:ETI"String#unpack;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"IDecodes <i>str</i> (which may contain binary data) according to the ;TI"Dformat string, returning an array of each value extracted. The ;TI"Jformat string consists of a sequence of single-character directives, ;TI"7summarized in the table at the end of this entry. ;TI"$Each directive may be followed ;TI"Eby a number, indicating the number of times to repeat with this ;TI"Adirective. An asterisk (``<code>*</code>'') will use up all ;TI"Hremaining elements. The directives <code>sSiIlL</code> may each be ;TI"7followed by an underscore (``<code>_</code>'') or ;TI"Aexclamation mark (``<code>!</code>'') to use the underlying ;TI"Iplatform's native size for the specified type; otherwise, it uses a ;TI"Eplatform-independent consistent size. Spaces are ignored in the ;TI"5format string. See also <code>Array#pack</code>.;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim; [ I"="abc \0\0abc \0\0".unpack('A6Z6') #=> ["abc", "abc "] ;TI"B"abc \0\0".unpack('a3a3') #=> ["abc", " \000\000"] ;TI">"abc \0abc \0".unpack('Z*Z*') #=> ["abc ", "abc "] ;TI"F"aa".unpack('b8B8') #=> ["10000110", "01100001"] ;TI">"aaa".unpack('h2H2c') #=> ["16", "61", 97] ;TI"9"\xfe\xff\xfe\xff".unpack('sS') #=> [-2, 65534] ;TI"8"now=20is".unpack('M*') #=> ["now is"] ;TI"G"whole".unpack('xax2aX2aX1aX2a') #=> ["h", "e", "l", "l", "o"] ;T:@format0o; ; [I"DThis table summarizes the various formats and the Ruby classes ;TI"returned by each.;T@o;; [WI"Integer | | ;TI"&Directive | Returns | Meaning ;TI"G----------------------------------------------------------------- ;TI"= C | Integer | 8-bit unsigned (unsigned char) ;TI"H S | Integer | 16-bit unsigned, native endian (uint16_t) ;TI"H L | Integer | 32-bit unsigned, native endian (uint32_t) ;TI"H Q | Integer | 64-bit unsigned, native endian (uint64_t) ;TI" | | ;TI"9 c | Integer | 8-bit signed (signed char) ;TI"E s | Integer | 16-bit signed, native endian (int16_t) ;TI"E l | Integer | 32-bit signed, native endian (int32_t) ;TI"E q | Integer | 64-bit signed, native endian (int64_t) ;TI" | | ;TI"< S_, S! | Integer | unsigned short, native endian ;TI": I, I_, I! | Integer | unsigned int, native endian ;TI"; L_, L! | Integer | unsigned long, native endian ;TI"O Q_, Q! | Integer | unsigned long long, native endian (ArgumentError ;TI"F | | if the platform has no long long type.) ;TI"G | | (Q_ and Q! is available since Ruby 2.1.) ;TI" | | ;TI": s_, s! | Integer | signed short, native endian ;TI"8 i, i_, i! | Integer | signed int, native endian ;TI"9 l_, l! | Integer | signed long, native endian ;TI"M q_, q! | Integer | signed long long, native endian (ArgumentError ;TI"F | | if the platform has no long long type.) ;TI"G | | (q_ and q! is available since Ruby 2.1.) ;TI" | | ;TI"H S> L> Q> | Integer | same as the directives without ">" except ;TI") s> l> q> | | big endian ;TI"; S!> I!> | | (available since Ruby 1.9.3) ;TI"2 L!> Q!> | | "S>" is same as "n" ;TI"2 s!> i!> | | "L>" is same as "N" ;TI" l!> q!> | | ;TI" | | ;TI"H S< L< Q< | Integer | same as the directives without "<" except ;TI", s< l< q< | | little endian ;TI"; S!< I!< | | (available since Ruby 1.9.3) ;TI"2 L!< Q!< | | "S<" is same as "v" ;TI"2 s!< i!< | | "L<" is same as "V" ;TI" l!< q!< | | ;TI" | | ;TI"O n | Integer | 16-bit unsigned, network (big-endian) byte order ;TI"O N | Integer | 32-bit unsigned, network (big-endian) byte order ;TI"N v | Integer | 16-bit unsigned, VAX (little-endian) byte order ;TI"N V | Integer | 32-bit unsigned, VAX (little-endian) byte order ;TI" | | ;TI". U | Integer | UTF-8 character ;TI"F w | Integer | BER-compressed integer (see Array.pack) ;TI" ;TI"Float | | ;TI"&Directive | Returns | Meaning ;TI"G----------------------------------------------------------------- ;TI"> D, d | Float | double-precision, native format ;TI"> F, f | Float | single-precision, native format ;TI"I E | Float | double-precision, little-endian byte order ;TI"I e | Float | single-precision, little-endian byte order ;TI"P G | Float | double-precision, network (big-endian) byte order ;TI"P g | Float | single-precision, network (big-endian) byte order ;TI" ;TI"String | | ;TI"&Directive | Returns | Meaning ;TI"G----------------------------------------------------------------- ;TI"_ A | String | arbitrary binary string (remove trailing nulls and ASCII spaces) ;TI"6 a | String | arbitrary binary string ;TI"5 Z | String | null-terminated string ;TI"5 B | String | bit string (MSB first) ;TI"5 b | String | bit string (LSB first) ;TI"= H | String | hex string (high nibble first) ;TI"< h | String | hex string (low nibble first) ;TI"0 u | String | UU-encoded string ;TI"L M | String | quoted-printable, MIME encoding (see RFC2045) ;TI"I m | String | base64 encoded string (RFC 2045) (default) ;TI"P | | base64 encoded string (RFC 4648) if followed by 0 ;TI"K P | String | pointer to a structure (fixed-length string) ;TI"B p | String | pointer to a null-terminated string ;TI" ;TI"Misc. | | ;TI"&Directive | Returns | Meaning ;TI"G----------------------------------------------------------------- ;TI"N @ | --- | skip to the offset given by the length argument ;TI"5 X | --- | skip backward one byte ;TI"3 x | --- | skip forward one byte;T; 0: @fileI"pack.c;T:0@omit_headings_from_table_of_contents_below0I"'str.unpack(format) -> anArray ;T0[ I" (p1);T@}FI"String;TcRDoc::NormalClassI" scanf;T0