Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/nwrfc/nwrfclib.rb,
lib/nwrfc/nwrfclib.rb

Instance Method Summary collapse

Instance Method Details

#cUObject

Convert string from UTF-8 to doudble-null terminated UTF-16LE string



63
64
65
# File 'lib/nwrfc/nwrfclib.rb', line 63

def cU
  (self.to_s + "\0").force_encoding('UTF-8').encode('UTF-16LE')
end

#uCObject

Convert string from UTF-16LE to UTF-8 and trim trailing whitespace



68
69
70
# File 'lib/nwrfc/nwrfclib.rb', line 68

def uC
  self.force_encoding('UTF-16LE').encode('UTF-8').strip
end