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

Convert numbers to letters

P: 127
Hi all,

I was wondering if there is a quick way to convert numbers to letters, such as 1=A, and 26=Z. I can do it the laborious way using 26 definitions, but it's always nice to know of any shortcuts!

Aug 18 '09 #1
Share this Question
Share on Google+
3 Replies

Expert Mod 5K+
P: 8,639
you can use the character’s Unicode value.
Expand|Select|Wrap|Line Numbers
  1. // A is #65 in Unicode
  2. String.fromCharCode(64+x);
Aug 18 '09 #2

P: 127
I guess that will convert it to UniCode, shift it across 64 members of the character set, and then convert it back.

Aug 19 '09 #3

Expert Mod 5K+
P: 8,639
not really, you put in a number (2) and get a letter back (B). (U+0002 is a control character)
Aug 20 '09 #4

Post your reply

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