I need help converting a string to double with 7 decimals. I have a string "00000827700000" and need it converted to 82.77
Tried using String.Format() with {0:N7} without success.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It looks like you could use:
That would actually parse it to 82.7700000, as
decimalpreserves trailing zeroes (to an extent) but maybe that’s good enough? It not, you could change the second argument toNote that I’d strongly recommend you to at least consider using
decimalinstead ofdouble. You haven’t explained what this value represents, but if it’s stored as decimal figures which you need to preserve, it smells more like adecimalto me.