Created
April 24, 2024 12:10
-
-
Save trycf/d49f0fcd4aaaa077cd7fbcb9539b4316 to your computer and use it in GitHub Desktop.
TryCF Gist
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
<cfscript> | |
//num = "1,234,567.89"; | |
//num = "1.234.567,89"; | |
//num = "1’234’567.89"; | |
//num = "1 234 576.89"; | |
//num = "1234567.89"; | |
num = "33"; | |
if(len(num) > 2) { | |
if(num[len(num) - 2] == ",") { | |
num = replace(num, ".", "", "all"); | |
num = replace(num, ",", ".", "all"); | |
} else { | |
num = reReplace(num, "[^\d\.]", "", "all"); | |
} | |
} | |
dump(num); | |
</cfscript> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment