I do a split(\' \')
over an string and I want to pull the first element of the returned string in order to get the rest of the string.
f.e. \"THIS IS
try
string X = "THIS IS AN AMAZING STRING";
string Y = (X.IndexOf ( " " ) < 0) ? string.Empty : X.Substring (X.IndexOf ( " " ) + 1); // Y = IS AN AMAZING STRING
As per comment (IF X
is guaranteed to be a valid string with at least one space) a simpler version without checking etc.:
string Y = X.Substring (X.IndexOf ( " " ) + 1);