Anders,
Have a look at "Custom Numeric Format Strings" in MSDN online help.
Here is a quick hack that seems to get what you are looking for:
/* *************************** */
static void Main(string[] args) {
System.Console.WriteLine("String : {0}",(39.12346D).ToString("0.0000"));
System.Console.WriteLine("String : {0}",(0.34D).ToString("0.0000"));
System.Console.WriteLine("String : {0}",(0.112234D).ToString("0.0000"));
}
/* *************************** */
and the output is:
String : 39.1235
String : 0.3400
String : 0.1122
regards
roy fine
"Anders Both" <an********@hotmail.com> wrote in message
news:O8**************@TK2MSFTNGP09.phx.gbl...
How do I convert a decimal to string, in a way so that only 4 digits after
the dot is present . E.G like in the below table:
Value : writeln
3.234556 : 3.2346 (or maybe just 3.2345)
0.34 : 0.3400
0.112234 : 0.1122
Best Regards,
Anders Both, Denmark.