I have a string = "google.com 220 USD 3d 19h".
I want to extract just the ".com" part.......
whats the easiest way to manipulate the split string method to get this result?
I'm guessing you either want to extract the domain name or the TLD part of the string. This should do the job:
var str = "google.com 220 USD 3d 19h";
var domain = str.Split(' ')[0]; // google.com
var tld = domain.Substring(domain.IndexOf('.')) // .com
Alternate idea
string str = "google.com 220 USD 3d 19h";
string match = ".com";
string dotcomportion = str.Substring(str.IndexOf(match), match.Length);
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