TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
joy.simpson
NA
228
0
How do you find the ASCII value of a character?
Jan 18 2004 1:34 PM
I got this much to work. It will print each character in the string with the ASCII value next to it. But how can I change it so the num variable is 65 less than the ASCII value so that A = 1, B = 2, etc? And how can I assign the ASCII value to the num variable? num = int(c) doesn't seem to work. static void Main(string[] args) { string mystring = "hello"; int num; mystring = mystring.ToUpper(); foreach(char c in mystring) { Console.Write("{0} - ",c); //num = int(c) - 65; //doesn't work Console.WriteLine(((int)c).ToString()); } }
Reply
Answers (
5
)
proper way to store unknown number of object instances?
Creating a PHP file from a C# script