Solved

String Formatting leading zeros

  • 21 November 2019
  • 1 reply
  • 32 views

Badge

Hi there,

I want to convert an attribute so it always has four digits, and two decimal places. As an example, if I have . 6.5 as the source, I want the output as 06.50.

I've used the expression 04.2f in a string formatter, but this doesn't seem to be working for all of my attributes

As an example if my source attribute is 50.7, it recognizes the format and the output is 50.70. But if I have an attribute with one single digit before the decimal place like 7.28 the output is still 7.28 and not 07.28

Let me know if you can help.

-Reid

icon

Best answer by reidm35 21 November 2019, 18:55

View original

1 reply

Badge

Oops I figured it out! The proper input for the String Formatter is 05.2f as the decimal point is being used as a part of the string. 5 is the width and 2 is the precision.

Reply