In my code behind in C# I have the following code. How do I change the replace so that only the first occurance of www is replaced? For example if the User enters www.testwww.com then I should be saving it as testwww.com. Currently as per the below code it saves as www.com (guess due to substr code). Please help. Thanks in advance.
private string FilterUrl(string url)
{
string lowerCaseUrl = url.ToLower();
lowerCaseUrl = lowerCaseUrl.Replace("http://", string.Empty).Replace("https://", string.Empty).Replace("ftp://", string.Empty);
lowerCaseUrl = lowerCaseUrl.Replace("www.", string.Empty);
string lCaseUrl = url.Substring(url.Length - lowerCaseUrl.Length, lowerCaseUrl.Length);
return lCaseUrl;
}