find mid point of string
I have a one string..i want to fetch application No after word " (21) Application No".can anybody give me some code for this?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Roei BarPosted Sep 14, 2009, 3:49 AM
to find the midPoint you will do the following code:
string test = "(21) Application N0";
int midPoint = test/2;
to find a location to Substring From, work with IndexOf
like the following
string test = "(21) Application N0";
int startIndex = test.IndexOf(')'); //this will give us the location to start the substring from
and then
test = test.Substring(startIndex);// we only need the start location since we want the rest of the sentence
Niradhip ChakrabortyPosted Sep 14, 2009, 3:27 AM
string test = "(21) Application N0";
test = test.Substring(4,test.Length-4);