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!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Is there a maximum limit to the number of digits?
You can instead use:
You can extend the
#out to whatever you want/consider reasonable. Following the.of the format specifier, a0indicates the decimal precision place should always be shown, while#indicates it should be shown if present.