I am trying to split the string in a word array, and get all the word except for the first word. Like something like this:
string s = "Hello World I am on stack overflow";
string result would give me:
"World I am on stack overflow"
This is what I've tried:
string First = "Hello World, This is First Sentence";
string words = First.Split(' ');
string AfterWord = words[First.Length-1];`
There's an overload of String.Split() that does this for you:
string sentence = "Hello World, This is First Sentence";
string words = sentence.Split(' ', 2);
string afterWord = words[1];
[and it's a lot more efficient that joining them back up again afterwards]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With