faqts : Computers : Programming : Languages : JavaScript : Language Core : Strings

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

51 of 76 people (67%) answered Yes
Recently 3 of 10 people (30%) answered Yes

Entry

How do I find the (ascii/iso/uni) character code of a character

Apr 15th, 2000 14:28
Martin Honnen,


JavaScript 1.2 introduced the 
  charCodeAt(index)
method for strings where index is optional and defaults to 0 thus
  var c = 'Kibo'.charCodeAt()
gives the character code of K,
  var c = 'Kibo'.charCodeAt(3)
gives the character code of o.
While charCodeAt works for iso/latin1 characters in JavaScript 1.2 it 
was extended in JavaScript 1.3 to cover unicode characters.