Remove comma from text representation of decimal?

1
Hi team, I’m trying to parseDecimal(‘1,470.00’)  and it’s failing *I think* because of the comma. Is there another function call that will treat this string as a decimal and not have a problem with the comma or the period? Showing hardcoded value here for illustration, but supplied value will be a text variable. Any assistance is greatly appreciated.   Cheers, Jeff G
asked
2 answers
4

Have you tried using replaceAll to remove commas?

parseDecimal(replaceAll('1,470.00', ',', '')) 

 

answered
3

Jeff,

I think parseDecimal will do the trick with the addition of 1 parameter.  You can add a format parameter to this function call.  In your case, it would look something like this parseDecimal(‘1,470.00’,’###,###.##’)  Note that you can make the number of digits as large as you think will be needed (i.e. millions, billions, etc.).  # means that digit is option.  if you replaced # with 0, that would make that digit required.

The documentation for this is not very thorough.  I’ve submitted some suggested changes to the documentation.

Hope that helps,

Mike

answered