JavaScript-The determining essence of the full-width half-angle of characters (strings)

Source: Internet
Author: User
The program often makes full-width half-width judgments about characters or strings, such as full-width letters, numbers, punctuation marks, and so on. There are many ways to make the right judgments, but what I want to know is what the nature of these judgments is, which is the conclusion that the character is encoded or the length of the character stored in the computer is determined by the full-width or half-angle. Although the issue of literacy level, but very much want to have a clear understanding of the nature of such problems, please the heroes of the road to enlighten! Thank you!
The implementation of language is not limited, preferably Php,java or JS.

Reply content:

The program often makes full-width half-width judgments about characters or strings, such as full-width letters, numbers, punctuation marks, and so on. There are many ways to make the right judgments, but what I want to know is what the nature of these judgments is, which is the conclusion that the character is encoded or the length of the character stored in the computer is determined by the full-width or half-angle. Although the issue of literacy level, but very much want to have a clear understanding of the nature of such problems, please the heroes of the road to enlighten! Thank you!
The implementation of language is not limited, preferably Php,java or JS.

This is actually very good to understand, half-width of what is only the difference between the display, in the final analysis of the conversion is actually stored in the computer machine code (do not know is not called this) different Ah, different machine code corresponding to different characters. To make a difference PHP can be escaped into \xe2 format (I do not know this format is called God Horse. ==!), JS should also have a corresponding method of it.

 
 
  • 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.