Tips for javascript to generate uppercase/lowercase letters _ javascript

Source: Internet
Author: User
This article will share with you the code for generating uppercase and lowercase letters in javascript, which is very simple and practical and mainly uses str. charCodeAt () and String. for more information about the fromCharCode () method, see. The str. charCodeAt () and String. fromCharCode () methods are mainly used.

-- Uses charCodeAt () to obtain the Unicode encoding of a specific character in a string.

-- FromCharCode () can accept one or more specified Unicode values, and then return the corresponding string.

// Generate the Unicode value of uppercase letter A as 65 function generateBig_1 () {var str = []; for (var I = 65; I <91; I ++) {str. push (String. fromCharCode (I);} return str;} // Generate the Unicode value of uppercase letter a as 97 function generateSmall_1 () {var str = []; for (var I = 97; I <123; I ++) {str. push (String. fromCharCode (I);} return str;} // convert the string to the Unicode code function toUnicode (str) {var codes = []; for (var I = 0; I
 
  

Available results --"

FromCharCode plays a major role in html object character conversion.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.