Have you tried just replacing them with nothing? If it's a string you could
do this like myString.Replace("\t","").Replace("\n","")

Signature
Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006
> Is there a way of checking that a line with escape sequences in it, has no
> strings in it (apart from the escape sequences)?
[quoted text clipped - 12 lines]
> Thanks,
> JJ
> Is there a way of checking that a line with escape sequences in it, has no
> strings in it (apart from the escape sequences)?
[quoted text clipped - 9 lines]
> Is there a way, or do I have to try and remove all the possible excape
> sequences by parsing the string?
There may be a "cleverer" more efficient way of doing this, but how about:
string strEscaped = "\n\t\t\t\thello\t\t\n";
string strUnescaped = strUnescaped.Replace("\n",
"").Replace("\t","").Replace("\r","");

Signature
http://www.markrae.net
JJ - 09 Jun 2007 16:04 GMT
Thats what I ended up doing (string.replace). My worry was that there seems
to be a lot of these possible escape sequences beyond the standard \r \t \n
etc. so I foolishly thought that there might be a 'built-in' method that
removes all possible sequences.
Thanks again,
John
>> Is there a way of checking that a line with escape sequences in it, has
>> no strings in it (apart from the escape sequences)?
[quoted text clipped - 15 lines]
> string strUnescaped = strUnescaped.Replace("\n",
> "").Replace("\t","").Replace("\r","");
Mark Rae - 09 Jun 2007 16:56 GMT
> My worry was that there seems to be a lot of these possible escape
> sequences
In fact, there are only a handful:
http://msdn2.microsoft.com/en-us/library/4edbef7e(VS.80).aspx
Seems like a good candidate for a static method:
public static string StripEscape(string pstrText)
{
string strStrippedText = pstrText;
strStrippedText = strStrippedText.Replace("\t", String.Empty);
strStrippedText = strStrippedText.Replace("\n", String.Empty);
// etc
return strStrippedText;
}
Obviously, the list of escape characters may change in future versions of
C#...

Signature
http://www.markrae.net