Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert string to char

Tags:

c#

I get from another class string that must be converted to char. It usually contains only one char and that's not a problem. But control chars i receive like '\\n' or '\\t'. Is there standard methods to convert this to endline or tab char or i need to parse it myself?

edit: Sorry, parser eat one slash. I receive '\\t'

like image 290
Denis Palnitsky Avatar asked Mar 18 '10 10:03

Denis Palnitsky


1 Answers

I assume that you mean that the class that sends you the data is sending you a string like "\n". In that case you have to parse this yourself using:

Char.Parse(returnedChar)

Otherwise you can just cast it to a string like this

(string)returnedChar
like image 52
Geoff Avatar answered Sep 22 '22 21:09

Geoff