I am given bunch of strings in the following format:
ASDF [ 6]
ZXC[1]
OtPasd[ 4 ]
asdffa[ 7]
I need to retrieve the integer betwee
To get the int in between the brackets you can also try this way:
string tmpString = "ASDF [ 6]";
int start = tmpString.IndexOf('[') + 1;
int length = tmpString.IndexOf(']') - start;
string subString = tmpString.Substring(start, length);
int tempInt;
if(Int.TryParse(subString, out tempInt))
return tempInt;