Wednesday, 21 August 2013

C# Trim/Replace the char '\"' from a string

C# Trim/Replace the char '\"' from a string

I need to use a string for path for a file but sometimes there are
forbidden characters in this string and I must replace them. For example,
my string _title is "rumbaton jonathan \"racko\" contreras".
Well I should replace the chars '\' and '"'.
I tried this but it doesn't work :
_title.Replace(@"/", "");
_title.Replace(@"\", "");
_title.Replace(@"*", "");
_title.Replace(@"?", "");
_title.Replace(@"<", "");
_title.Replace(@">", "");
_title.Replace(@"|", "");
Thank you so much,
Veriditas !

No comments:

Post a Comment