Skip to main content
Solved

String Formatting leading zeros

  • November 21, 2019
  • 1 reply
  • 165 views

reidm35
Forum|alt.badge.img

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

Best answer by reidm35

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.

View original
Did this help you find an answer to your question?

1 reply

reidm35
Forum|alt.badge.img
  • Author
  • Best Answer
  • November 21, 2019

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.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings