Re: Character representation
From: Chad Myers (cmyers_at_N0.SP4M.austin.rr.com)
Date: 10/08/04
- Next message: Shiva: "Re: Character representation"
- Previous message: Nicholas Paldino [.NET/C# MVP]: "Re: Character representation"
- In reply to: Gas: "Character representation"
- Next in thread: Shiva: "Re: Character representation"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 08 Oct 2004 15:51:45 GMT
"Gas" <gasxxx@hotmail.com> wrote in message
news:ukv7nvUrEHA.2732@TK2MSFTNGP09.phx.gbl...
> Hi,
>
> I am wondering how can I representation some of the specical characters in
> C#?
> (for example, we use vbKeyTab for Tab and vbCrLf for line feed in VB)
>
> Also is there any character to ASCII code and ASCII code to character
> built-in function in C#?
\r = carriage return
\n = linefeed (\r\n = vbCrLf)
\t = tab
\" = double quote
There are a few other esoteric ones, but those are the most common.
As far as char-to-code and vice versa:
// code will be 32 or 0x20
int code = (int) ' ';
// spaceChar will be ' '
char spaceChar = (char) 32;
Please be aware that strings and chars in .NET are Unicode. If you hit
some special unicode characters or other languages and such, you may
get unexpected results. In general, you should try to avoid worring about
what the ASCII code is for a given char because it's not reliable in an
internationalized sense.
-c
- Next message: Shiva: "Re: Character representation"
- Previous message: Nicholas Paldino [.NET/C# MVP]: "Re: Character representation"
- In reply to: Gas: "Character representation"
- Next in thread: Shiva: "Re: Character representation"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|