0

I am trying to display 2 decimals without rounding. I am using the below formula but each time its being rounded. For example ${52.3356?string[",##0.00"]} = 52.34, I need to display 52.33. I read many articles and all say this formula works, why its not working at my end?

  • you can use javascript function `.toFixed()` only if your value is number – HiddenOne1254 Aug 10 '22 at 12:36
  • @AnkitPandey You don't want to and possibly even cannot involve JavaScript here – Jasper de Vries Aug 10 '22 at 12:40
  • Is the following code janky? Yes. Should there be a better way? Yes. Still technically this works... <#assign numberTimesHundred = number * 100> <#assign numberTimesHundredInt = rateTimesHundred?string?keep_before('.')> <#assign truncatedNumber = (rateTimesHundred?number / 100)?string(",##0.00")> – Nadav Julius Aug 11 '22 at 15:10
  • Honestly I feel like you can achieve this with regex but I'm no regex wizard. In any event the way you are trying will not work. You can changing the rounding conditions for example ",##0.00;; roundingMode=halfUp" but cannot truncate in this manner. – Nadav Julius Aug 11 '22 at 15:15

0 Answers0