I can't beleive I'm unable to find the answer to this, but I've spent all
afternoon trying to figure out how to get a char from a (valid) string that
makes an escape sequence (the two character "\n" becomes the single
character '\n').

This is for a C# compiler where the token sequence is already parsed, so it
is known to be valid. For a simple chars (like 'a') Char.Parse() works fine.
The problem comes with the other three types of chars, simple escape
sequences (char c = '\n';), hex escapes (char c = '\xFF'), and unicode
escapes (char c = '\U0000';). From this I get a string like
{'\\','x','F','F'} and I can't figure out what part of the Framework can
convert that string to a char.

Char.Parse only allows a single letter, and in spite of all the encoding,
formatting, String.Info, TextElement etc classes I've tried, I can't seem to
get something that breaks down the string into the char. Obviously it can be
done -- assigning "\n" to a textbox.Text converts it, what am I missing?

Sorry if this is obvious, I just can't seem to find it.

Thanks in advance,
Robin

===================================
This list is hosted by DevelopMentor�  http://www.develop.com
Some .NET courses you may be interested in:

NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles
http://www.develop.com/courses/gaspdotnetls

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to