I have a string which holds 0.5. I have to convert in to 0.50.
I have tried following ways but nothing works.Please help
hdnSliderValue.Value is 0.5,I want workFlow.QualityThresholdScore to be 0.50
workFlow.QualityThresholdScore = Convert.ToDecimal(String.format("{0:d}",hdnSliderValue.Value));
workFlow.QualityThresholdScore = Convert.ToDecimal(String.format("{0:0.00}",hdnSliderValue.Value));
IS there any built in function or will i have to do string handling to accomplish this.
The simplest way probably is to use string conversions:
That’s pretty ugly though 🙁
You certainly could do it by first parsing the original string, then messing around with the internal format of the decimal – but it would be significantly harder.
EDIT: Okay, in case it’s an i18n issue, here’s a console app which should definitely print out 0.50: