Is there a way I can remove substrings from my string on the basis of any identifier?
Like I have
string codeID = "347439>Dome";
string newCodeId = "347439"
this could be another possibility:
string codeID = "347439>Dome"; string newCodeId = codeID.Split('>'); Console.WriteLine(newCodeId);
It uses the
String.Split() method which returns a
string. To get the left part of the
string here I took the first element in the array. The rest of the string is (in this case) in position
in the case that there is not
> separator in the string. it will just the entire old string in position