Created
December 5, 2022 23:52
-
-
Save awesome/10750767c628a3fa7b5908941f4138c9 to your computer and use it in GitHub Desktop.
gsub-string-parse-number-with-comma-and-decimal.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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