468,792 Members | 1,725 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,792 developers. It's quick & easy.

convert a number to its ascii value

How do I convert a number to its ascii value in c#?
What is the equivalent of VB's chr() function in c#?

thanks in advance
Nov 15 '05 #1
2 39952
questions <an*******@discussions.microsoft.com> wrote:
How do I convert a number to its ascii value in c#?
What is the equivalent of VB's chr() function in c#?


Just cast it to an int, or assign it to an int variable.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 15 '05 #2
questions <an*******@discussions.microsoft.com> wrote:
How do I convert a number to its ascii value in c#?
What is the equivalent of VB's chr() function in c#?


Sorry, my previous answer was character -> Unicode value. To get from
Unicode value -> character, just cast to char:

int i = 65;

char c = (char) i; // c now equals 'A'

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 15 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Steve Horsley | last post: by
6 posts views Thread by Haas | last post: by
3 posts views Thread by Joshua Russell | last post: by
1 post views Thread by James Dean | last post: by
2 posts views Thread by Microsoft News | last post: by
3 posts views Thread by Wayne Wengert | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
2 posts views Thread by Marin | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.