I'm Adding strings in loop and for each loop I need to check whether it doesn't cantains / on its end.
e.g. www.google.com/ needs to result in www.google.com
but for www.google.com/maps needs to result in www.google.com/maps
serviceLink.Add(row.LinkService.Replace(Environment.NewLine, " ").Replace("http://",""));
May someone please help me solve thi out?
I thought that .Replace(".com/",".com") would be enough but it wouldn't handle other domains.
Thank you for your time and answers.
Uriclass instead of parsing the string yourself. What if it starts with"https://"?