I'm trying to split a string at the first space and only keep the 2nd half. So if the input was "1. top of steel", the output would be "top of steel". I'm working with a few different examples from here and I cant get it to work. Thoughts? Thanks.
var myString = "1. top of steel";
var newString = myString.Remove(0, myString.IndexOf(' ') + 1);
This is easily accomplished using Substring
:
string myString = "1. top of steel";
string newString = myString.Substring(myString.IndexOf(' ') + 1);
This will give you a new string starting after the first space.
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