Method: String#rstrip

Defined in:
ext/enterprise_script_service/mruby/mrbgems/mruby-string-ext/mrblib/string.rb

#rstripObject

call-seq:

str.rstrip   -> new_str

Returns a copy of str with trailing whitespace removed. See also String#lstrip and String#strip.

"  hello  ".rstrip   #=> "  hello"
"hello".rstrip       #=> "hello"


43
44
45
46
47
48
# File 'ext/enterprise_script_service/mruby/mrbgems/mruby-string-ext/mrblib/string.rb', line 43

def rstrip
  a = 0
  z = self.size - 1
  z -= 1 while a <= z and " \f\n\r\t\v\0".include?(self[z])
  (z >= 0) ? self[a..z] : ""
end