For coding reasons which would horrify you (I\'m too embarrassed to say), I need to store a number of text items in a single string.
I will delimit them using a char
For fast escaping I use stuff like this: say you want to concatinate str1, str2 and str3 what I do is:
delimitedStr=str1.Replace("@","@a").Replace("|","@p")+"|"+str2.Replace("@","@a").Replace("|","@p")+"|"+str3.Replace("@","@a").Replace("|","@p");
then to retrieve original use:
splitStr=delimitedStr.Split("|".ToCharArray());
str1=splitStr[0].Replace("@p","|").Replace("@a","@");
str2=splitStr[1].Replace("@p","|").Replace("@a","@");
str3=splitStr[2].Replace("@p","|").Replace("@a","@");
note: the order of the replace is important
its unbreakable and easy to implement