String Format Specifier
Posted: Fri Sep 21, 2012 12:59 pm
Hello,
I have a tag of data type FLOAT. I want to convert the tag value to a string with two decimal places of precision. For example, value 10.12345678 would be converted to "10.12". This is what I am using:
String s = String.Format("{0:0.00}", Globals.Tags.DischargeRate.Value);
However, s does does not become "10.12", instead it becomes "10.123456". I have also tried:
String s = String.Format("F3", Globals.Tags.DischargeRate.Value);
with the same result. How to accomplish this? I am using A12 and iX 2.0;
I have a tag of data type FLOAT. I want to convert the tag value to a string with two decimal places of precision. For example, value 10.12345678 would be converted to "10.12". This is what I am using:
String s = String.Format("{0:0.00}", Globals.Tags.DischargeRate.Value);
However, s does does not become "10.12", instead it becomes "10.123456". I have also tried:
String s = String.Format("F3", Globals.Tags.DischargeRate.Value);
with the same result. How to accomplish this? I am using A12 and iX 2.0;