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 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.Trim();
string ReplaceText = @" abcd , cdef , efg , ijk , lmn";
ReplaceText = ReplaceText.Substring(0, ReplaceText.IndexOf(","));
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)