String s = "test'quotes"; String Result; for(int i=1;i<=s.Length();i++) { if(s[i]=='\'') Result += "'"; Result += s[i]; }