c# - When converting a string of numbers to int , it returns Ascii code for the string? -


i have strings in format below: "p100" "p231" "p000" . . .

these strings button names , last 3 characters referring cell of 3d array,and need convert strings integers cell address, use this:

string str = clickedbutton.name.tostring(); int xi ; int xj; int xz; xi = convert.toint32(str[1]); xj = convert.toint32(str[2]); xz = convert.toint32(str[3]); 

please note don't use "str[0]" because "p".

but when compile code , value of xi,xj,xz ascci values of string characters.

how should convert string int won't happen?

do following:

int xi = (int)char.getnumericvalue(str[1]); 

also refer this


Comments

Post a Comment

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -