c# getting a string within another string -
I have such a string:
some_string = "SMS text is a simple Demo messaging. \ R \ n + CMGW: 3216 \ r \ n \ r \ n oak \ r \ n \ "
im coming from vb.net and in c # Need to know, if I know the status of CMGW, how can I get 3216 "" from there?
I know that my starting should be the situation of CMGW + 6, but how will I stop it soon
Again, my last result should be 3216
Thanks!
index
\ r
at the beginning of the place where you are interested , And use it:
/ / Product code: Add verification here. // (check for each index -1, which means "not found") int cmgwIndex = text.IndexOf ("CMGW:"); // just a helper variable; The code below creates a little pretty int startIndex = cmgwIndex + 6; Int crIndex = text.IndexOf ("\ r", startIndex); String middlePart = text.Substring (startIndex, crIndex - startIndex);
Comments
Post a Comment