Method: StringNumericHelper#get_floats

Defined in:
lib/rubyhelper/string_numeric.rb

#get_floats(sep = ' ', sign = true) ⇒ Array of String

get all digit and symboles from a splited string if sep is a sign and the param sign == true, then theses signs will be splited first see also #get_1float and #get_floats

Parameters:

  • sep (String or Regexp) (defaults to: ' ')

    separator

  • sign (true or false or :less) (defaults to: true)

    if true, keep the - and + signs, if :less, only keep -

Returns:

Raises:

  • ArgumentError if sep is not a String



137
138
139
140
# File 'lib/rubyhelper/string_numeric.rb', line 137

def get_floats(sep = ' ', sign = true)
  raise ArgumentError, "sep must be a String" unless sep.is_a? String or sep.is_a? Regexp
  return self.split(sep).map{|e| e.get_float(sign)}
end