class String
Constants
- BLANK_RE
Public Instance Methods
blank?()
click to toggle source
A string is blank if it’s empty or contains whitespaces only:
''.blank? # => true ' '.blank? # => true "\t\n\r".blank? # => true ' blah '.blank? # => false
Unicode whitespace is supported:
"\u00a0".blank? # => true
@return [true, false]
# File lib/fir/patches/blank.rb, line 116 def blank? BLANK_RE === self end
to_utf8()
click to toggle source
Convert String
encoding to UTF-8
@return string
# File lib/fir/patches/native_patch.rb, line 25 def to_utf8 encode(Encoding.find('UTF-8'), invalid: :replace, undef: :replace, replace: '') end