Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/uscommerce.rb

Instance Method Summary collapse

Instance Method Details

#numeric_string_to_us_formatObject

Turns a numeric string into U.S. format if it's not already formatted that way.

"10,00".numeric_string_to_us_format -> "10.00"
"10.00".numeric_string_to_us_format -> "10.00"

39
40
41
42
43
# File 'lib/uscommerce.rb', line 39

def numeric_string_to_us_format
	numericString = clone
	numericString.gsub!(/,/, '.') if numericString =~ /,\d{2}$/
	numericString
end