473,394 Members | 1,773 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

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 40296
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Steve Horsley | last post by:
How can I get the ASCII value of a character, e.g. I have: str = "A B" for index in range(0, len(str)): value = WHAT_GOES_HERE?(str) print value and I hope to get: 65
6
by: Haas | last post by:
Hello folks, I just started a C++ course. An exercise is to give the ASCII value of a character read from keyboard. I place the input from the keyboard in a char-variable. How can i get the...
7
by: Golan | last post by:
Hi, I need to convert a Binary value to Decimal. I've been told that the value is an unsigned one. How can I do this? I use memcpy into an unsigned char variable, but when I print the value I got...
3
by: Joshua Russell | last post by:
Hi, Can anyone tell me how I can convert an Intager value such as '66' into the letter 'f' (using ANSI ASCII). Thanx Josh
1
by: James Dean | last post by:
i want to be able to get the correct ascii value from a byte without having to use the Convert.ToChar function as a char takes up two bytes of space and it is affecting the performance of my...
2
by: Microsoft News | last post by:
Hoe to calculate ASCII value of a character
3
by: Wayne Wengert | last post by:
I want to pass the ASCII value of a keystroke to a sub that checks for valid characters (see sample below). I have looked through the possible choices for "values" of the e.KeyChar but I can't find...
2
saranjegan
by: saranjegan | last post by:
Dudes, this is my doubt i need to rename a file,i can make it thru rename function..but the modified name should be an original name added with ascii value of 23.. these are questions...
6
by: ssetz | last post by:
Hello, For work, I need to write a password filter. The problem is that my C+ + experience is only some practice in school, 10 years ago. I now develop in C# which is completely different to me....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.