简体   繁体   中英

C# Decimal ToString() moving the decimal place

I have the # 508600000 stored as a decimal value. I convert it into a string and then I need to turn it into 0.00000508600000 . I know I could multiply my decimal value 0.00000000000001 and get the same answer, but I'd rather do it as a string . Is there any formatting in ToString() to make this happen?

毫无意义,但仍然:

string result = "0.00000" + 508600000;
decimal x = 508600000;
string z = String.Format("0.00000" + x);

You can use String.Format()

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM