How to find ASCII code for a char?

admin

Administrator
Staff member
Dear all:

Please help! I need to do a hash for a string. But I cannot figure out how to find out the ASCII code of a char (or convert char to int). How to do it in javascript?

e.g., the Java code:

int hash=0;
for(int i=0;i<mystring.length();i++)
{
hash=hash<<3;
hash+=(int)mystring.charAt(i);
}

Thank you very much!
 
Back
Top