I like to have a decimal format to 0.9563 so I have things like this:
compData.Comp1Value = String.Format("{0:0,0.####}", Convert.ToDecimal(comp1Val));
However, the number comes out like 00.9563. so I added.TrimStart('0') to the end like:
compData.Comp1Value = String.Format("{0:0,0.####}", Convert.ToDecimal(comp1Val)).TrimStart('0');
It number came out like.9563.
How do I format it to come out like 0.9563?
I change it to {0:0.####} and it works.
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.