Tuesday 15 June 2010

c# - Get string between two strings in a string -


I have a string:

  "Super example of string key: text I want I want to keep it - the end of my string "  

I just want to keep the string that is between the " key ":" and "-" How can I do that? Should I use a regx or can I do it any other way?

Perhaps, a good way To make a substring cut:

  string str = "super example of string key: I want to put text - end of my string"; int pFrom = St.IndexOf ("key:" ) "Key:". Lt; int pTo = St.LastIndexOf ("-"); String result = St. substrings (pFrom, pTo - pFrom);    

No comments:

Post a Comment