Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save awesome/10750767c628a3fa7b5908941f4138c9 to your computer and use it in GitHub Desktop.
Save awesome/10750767c628a3fa7b5908941f4138c9 to your computer and use it in GitHub Desktop.
gsub-string-parse-number-with-comma-and-decimal.rb
str = "Czech Republic,CZK,139,000.00"
str.gsub(/[^\d\.,]/, '').gsub(/^,+/,'')
# => "139,000.00"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment