6 examples of 'javascript getcharcode' in JavaScript

Every line of 'javascript getcharcode' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
1function getCharCode(char) {
2 return char.charCodeAt(0);
3}
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

42function charCode(chr) {
43 var esc = /^\\[xu](.+)/.exec(chr);
44 return esc ?
45 dec(esc[1]) :
46 chr.charCodeAt(chr.charAt(0) === '\\' ? 1 : 0);
47}
182function charCodeToKeyCode(charCode) {
183 var lookup = {
184 '0': 48, '1': 49, '2': 50, '3': 51, '4': 52, '5': 53, '6': 54, '7': 55, '8': 56, '9': 57, 'a': 65, 'b': 66, 'c': 67,
185 'd': 68, 'e': 69, 'f': 70, 'g': 71, 'h': 72, 'i': 73, 'j': 74, 'k': 75, 'l': 76, 'm': 77, 'n': 78, 'o': 79, 'p': 80, 'q': 81,
186 'r': 82, 's': 83, 't': 84, 'u': 85, 'v': 86, 'w': 87, 'x': 88, 'y': 89, ' ': 32, ',': 188, '-': 189, '.': 190, '/': 191, '\\': 220,
187 '[': 219, ']': 221, '\'': 222, ';': 186, '=': 187, ')': 41
188 };
189
190 return lookup[String.fromCharCode(charCode)];
191}
174"set charCode": function charCode(value) {
175 this.nativeObject.charCode = value;
176},
786function convertKeycode(_char) {
787 // upper case
788 var ret = false;
789 var c = _char;
790
791 if(c.length === 1) {
792 var keycode = c.charCodeAt();
793 // 65 ~ 90, 90 ~ 122
794 if(keycode >= 65 && keycode <= 90 &&
795 keycode >= 90 && keycode <= 122) {
796 ret = true;
797 }
798 } else {
799 keycode = KEY[c];
800 if(keycode) {
801 ret = true;
802 }
803 }
804
805 if(ret) {
806 return keycode;
807 } else {
808 return null;
809 }
810
811}
37function charCodeToLower(charCode) {
38 if (A_CODE <= charCode && charCode <= Z_CODE) {
39 return charCode + a_CODE - A_CODE;
40 }
41 return charCode;
42}

Related snippets