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

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

Kivy: Swiping (Carousel & ScreenManager) -