From Here
public static String FindAndReplace(String GivenString, String Pattern, String ReplaceString)
{
int j = 0;
int tempi;
for (int i = 0; i < GivenString.Length; i++)
{
tempi = i;
j = 0;
while (i<GivenString.Length && j< Pattern.Length && GivenString[i] == Pattern[j])
{
i++;
j++;
}
if (j == Pattern.Length)
{
GivenString = GivenString.Substring(0, tempi) + ReplaceString + GivenString.Substring(i, GivenString.Length - i);
i = tempi + ReplaceString.Length-1;
continue;
}
i = tempi;
}
return GivenString;
}