Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

Printf with Thousands Separators

saullipton
2021-01-19
2021-01-22
  • saullipton - 2021-01-19

    Hello,
    I would like to output floating point numbers that include the thousands separators. In the US they would be commas",". For example, using %f with 12345.67 should yield "12,345.67". Is this possible without manually separating the number into strings? For example, can we set a locale that would specify the separators? Can we use printf to format the string correctly?
    Thanks!

     
  • m.prestel - 2021-01-22

    Hello @saullipton,

    internally printf is used for most of the formatting.
    I did not find any flag to print out the number in the US style.

    Best regards,
    Marcel

     

    Last edit: m.prestel 2021-01-22

Log in to post a comment.