string str=" Motin AS fahami.menu.Asgar AS ASRAF"
string str=" Motin AS fahami.menu.ASIM AS SUVASISH"
string str=" Motin AS fahami.menu.ASIM AS SUVASISH"; string str2; int i = str.LastIndexOf(" AS "); str2 = str.Substring(0, i);
string delimiter = " AS "; //note the spaces either side string str = "Motin AS fahami.menu.ASIM AS anything that doesn't contain the delimiter"; string[] elements = System.Text.RegularExpressions.Regex.Split(str, delimiter); string result = elements[0] + delimiter + elements[1];
string str=" Motin AS fahami.menu.ASIM AS SUVASISH" if(str.Contains(" AS ")) //if you use indexOf in a string without being sure the string conatins your search string, an exception will be thrown { //gett the index of the last occurance int idexOfLastOccurance = str.LastIndexOf(" AS "); //Remove all the text starting from the index str = str.Remove(idexOfLastOccurance); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)