class BinData::Stringz

def trim_to!(str, max_length = nil)

def trim_to!(str, max_length = nil)
  if max_length
    str.slice!(max_length..-1)
    str[-1, 1] = "\0" if str.length == max_length
  end
end