Trimming a float

c#, digit, floating-point, winforms

Solution

I usually use a format string like `"#0.0000"`.

Problem

Possible Duplicate: Leave only two decimal places after the dot Formatting a float to 2 decimal places If I have a float that consists of something like 153.2154879, is there any way to convert it to string but only show 4 decimal places? I know I can format it using `"000.000"`, but the front number doesnt always have to be 3 digits. So is there a way to show all the front numbers (153), but only the first 4 characters after the point in a string?

Original source

Related problems