Skip to content

Instantly share code, notes, and snippets.

Created April 5, 2017 19:04
Show Gist options
  • Save anonymous/f103f7d0c1241bdb92b3838d495be1ea to your computer and use it in GitHub Desktop.
Save anonymous/f103f7d0c1241bdb92b3838d495be1ea to your computer and use it in GitHub Desktop.
TryCF Gist
<cfscript>
source1 = '2 000,99';
source2 = '2,000,99';
// remove ALL commas and spaces
example1 = REReplace(source1,"[\s,]","","all");
example2 = REReplace(source2,"[\s,]","","all");
// insert a decimal before the last two digits
example1 = Insert(".",example1,(Len(example1)-2));
example2 = Insert(".",example2,(Len(example2)-2));
writeOutput(source1 & " = " & example1);
writeOutput("<br>");
writeOutput(source2 & " = " & example2);
</cfscript>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment