Skip to content

Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →

instance method

String#unpack1

(::string template, ?offset: ::int) -> (::Integer | ::Float | ::String)?
unpack1(template, offset: 0) → object

Like String#unpack, but unpacks and returns only the first extracted object. See Packed Data.

Ruby version changes

  1. 3.1
See also #unpack #upcase #unicode_normalized? #upcase! also in 4.1 · 4.0 · 3.3 · 3.2 · 3.1 · 3.0