I have problem with my code , I want to replace specific string to a new one but it doesn't work
public void InsertYahoo(TextBox sender)
{
if (IsGmail(sender))
{
ReplaceGmail(sender);
}
else if(IsYahoo(sender))
{
return;
}
else
{
sender.Text +="@yahoo.com";
}
}
public bool IsYahoo(TextBox sender)
{
if (sender.Text.Contains("@yahoo.com")
{
return true;
}
else
{
return false;
}
}
public bool IsGmail(TextBox sender)
{
if (sender.Text.Contains("@gmail.com")
{
return true;
}
else
{
return false;
}
}
public void ReplaceGmail(TextBox sender)
{
sender.Text.Replace("@gmail.com, "@yahoo.com");
}
This code what i tried , so any suggestions? Also I tried to get the index of @gmail.com and remove it but it did not work neither