Float to string with at least one digit after period

c#

Solution

Is there a maximum limit to the number of digits?

You can instead use:

String.Format("{0:0.0#####}", floatVal)

You can extend the `#` out to whatever you want/consider reasonable. Following the `.` of the format specifier, a `0` indicates the decimal precision place should always be shown, while `#` indicates it should be shown if present.

Problem

How do I format a Float to String: 1 => "1.0" 1.12345 => "1.12345" Instead of: ``` String.Format("{0:0.0}", 123.0); // Limit amount of digits ``` Thank you!

Original source