Is it possible to avoid padding in double.ToString("F4") if the double only has less than 4 digits after the decimal?
eg
double a = 1.1; //MyToString("F4") -> "1.1"?
double b = 1.11111; //MyToString("F4") -> "1.1111"
You need ToString("#.0###")
& it will pad with 0 in the end or will round it of . See https://dotnetfiddle.net/PbL3Yc
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.