> irb(main):024:0> a = 'test' << 0 > "test\000" > irb(main):025:0> a.delete!( ) > > What do I pass to delete! in order to remove the null > character? (Can't use > chop, it may not always be there in the data I'm working with) Well, this works, but is there a more concise way to do it: irb(main):030:0> a = 'test' << 0 "test\000" irb(main):031:0> b = '' "" irb(main):032:0> a.each_byte do |byte| b << byte if byte != 0 end "test\000" irb(main):033:0> b "test"