class String def remove_whitespace self.gsub(" ","") end def is_i? !!(self =~ /^[-+]?[0-9]([0-9]*)?$/) end def to_utf16le Iconv.conv('utf-16le', 'UTF-8', self) end def to_active_record_condition "%#{self.trim.gsub(/[[:space:]]+/, '%')}%" end def blank? self !~ /\S/ rescue ArgumentError => e if e.message =~ /^(invalid\ byte\ sequence|incompatible\ character\ encodings)/ empty? else raise e end end end