abcd , cdef , efg , ijk , lmn <pre> i need to get the part before the first occurrence of ' , ' ie abcd. i thought of using string.split() or string.substring() but it's not generic as i need to have the position of the characters which i don't have. i need something generic.
string part=Mystring.SubString(0,Mystring.IndexOf(','));
string s = "abcd, cdef, efg, ijk, lmn"; string result = s.Substring(0, s.IndexOf(","));
string input = "abcd , cdef , efg , ijk , lmn"; string[] splitString = input.split(','); string result = splitString[0].Trim();
string ReplaceText = @" abcd , cdef , efg , ijk , lmn"; ReplaceText = ReplaceText.Substring(0, ReplaceText.IndexOf(","));
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)