c# - Something strange with string ToDouble conversion -


i have 555 555 555 in box.text (i have trimmed value) call

double result = convert.todouble(box.text, cultureinfo.invariantculture); 

and result is

555 555 584  

why??? have been waiting same 555 555 555 strange bug, or have missed something??

i have found solution 555 555 584 maximum value pre difined before. question closed

something missing question. input string cannot have spaces , output of double containing spaces not possible.

double result = convert.todouble("555 555 584", cultureinfo.invariantculture); 

results in:

an unhandled exception of type 'system.formatexception' occurred in mscorlib.dll

additional information: input string not in correct format.

try this:

string value = box.text.replace(" ", ""); double result = convert.todouble(value, cultureinfo.invariantculture); 

Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -