From: "Lucas L." Date: 2008-06-15T18:08:57+09:00 Subject: Re: Binary string packing/unpacking issues Todd Benson wrote: > On Sun, Jun 15, 2008 at 12:16 AM, Lucas L. wrote: > >> How can I replace portions of a packed binary string this way? >> I know with a normal string it is easy: >> irb(main):001:0> s = "abcdef" >> => "abcdef" >> irb(main):002:0> s[0..2] = "cba" >> => "cba" >> irb(main):003:0> s >> => "cbadef" >> >> But I can't figure out how to do it with binary. > > Look closely at Robert's irb line number 9. > > A string is just bytes in a row with special characteristics/methods. > > Todd You'll have to bear with me on this, I struggle with this sort of this. I don't really know what using | achieves. And a string may be bytes normally, but mine is a sequence of bits (well is it in my flawed understanding). I'm using Gtk::Pixbuf.pixels, if that helps at all. Sorry for the stupidity. -- Posted via http://www.ruby-forum.com/.