KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have a Double which could have a value from around 0.000001 to 1,000,000,000.000 I wish to format this number as a string but conditionally depending on its size. So if it's very small I want to format it with something like: String.Format("{0:.000000000}", number); if it's not that small, say 0.001 then I want to use something like String.Format("{0:.00000}", number); and if it's over, say 1,000 then format it as: String.Format("{0:.0}", number); Is there a clever way to construct this format string based on the size of the value I'm going to format?
Tags (comma-separated)
Save Edits
Cancel