From: Mike Stok Date: 2004-04-25T07:44:05+09:00 Subject: Re: String#unpack and null-terminated strings Michael Neumann writes: > Hi, > > How can I unpack two or more consecutive C-strings with the > String#unpack method? Like this: > > "abc\000def\000".unpack("??") # => ["abc", "def"] > > Currently, this seems not to be possible. Any chance to get the > following patch applied, which implements exactly this? You could use String#split e.g. irb(main):001:0> "abc\000def\000".split(/\0/) => ["abc", "def"] I know it's not String#unpack, but hope it helps. Mike -- mike@stok.co.uk | The "`Stok' disclaimers" apply. http://www.stok.co.uk/~mike/ | GPG PGP Key 1024D/059913DA mike@exegenix.com | Fingerprint 0570 71CD 6790 7C28 3D60 http://www.exegenix.com/ | 75D2 9EC4 C1C0 0599 13DA