Convert ASCII

  • Thread starter Thread starter Jeremy
  • Start date Start date
J

Jeremy

How do I get a string representation of an ascii value ? I'm trying to work
out whether a string contains a carriage return, so I need a string
representation of ascii value 13, in c#

Please help !
 
Jeremy said:
How do I get a string representation of an ascii value ? I'm trying to work
out whether a string contains a carriage return, so I need a string
representation of ascii value 13, in c#

ASCII 13 is easy - it's just "\r".

However, to get from any Unicode value to the character, just cast:

int i = 13;

char c = (char)i;
 
OK just realised Im being stupid, I can get carriage return via "\r", but
I'm still interested to know how to convert any ascii value to a character
or a string.
 
* "Jeremy said:
OK just realised Im being stupid, I can get carriage return via "\r", but
I'm still interested to know how to convert any ascii value to a character
or a string.

'Convert.ToChar'.
 
Back
Top