Method: String::StringExtensions#asciiz
- Defined in:
- lib/ruckus/extensions/string.rb
#asciiz ⇒ Object
Sometimes string buffers passed through Win32 interfaces come with garbage after the trailing NUL; this method gets rid of that, like String#trim
31 32 33 34 35 36 37 |
# File 'lib/ruckus/extensions/string.rb', line 31 def asciiz begin self[0..self.index("\x00")-1] rescue self end end |