By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,961 Members | 2,492 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,961 IT Pros & Developers. It's quick & easy.

How do you assign a specific number to each letter in a sentence

P: 1
I'm new to C# and have scoured over the web for a solution. I have a string - a whole sentence that I want to assign a number to each letter, space, comma and period etc. So all "A's" will have the same number, all "B's" will have another number etc. I don't want to use the ASCII numbers because they all need to be sequential and some of the punctuation isn't. I have put the string into a char array to separate each character out and was thinking about running it through a loop with if statements for each letter and assigning numbers there and then saving the numbers in the order they appear into a list as a string but I keep coming up with errors so I don't know how to do it or if there is a better way to accomplish what I'm trying to do. Any help would be greatly appreciated.
Feb 14 '14 #1
Share this Question
Share on Google+
1 Reply

P: 94
Hello! Could you post your code? Thanks!
Feb 14 '14 #2

Post your reply

Sign in to post your reply or Sign up for a free account.