=' A' )&&(ch<='Z')". Character data is stored in ASCII code internally in the computer. English uppercase letters and lowercase letters are consecutive in the ASCII code table."/> =' A' )&&(ch<='Z')". Character data is stored in ASCII code internally in the computer. English uppercase letters and lowercase letters are consecutive in the ASCII code table.">

Home  >  Article  >  Backend Development  >  What is the correct expression to determine whether the char variable ch is an uppercase letter?

What is the correct expression to determine whether the char variable ch is an uppercase letter?

藏色散人
藏色散人Original
2020-08-05 11:02:4018507browse

The correct expression to determine whether the char variable ch is an uppercase letter is "(ch>=' A' )&&(ch<='Z')". Character data is encoded in ASCII code internally in the computer. Stored, English uppercase letters and lowercase letters are consecutive in the ASCII code table.

What is the correct expression to determine whether the char variable ch is an uppercase letter?

The correct expression to determine whether the char variable ch is an uppercase letter is "(ch>=' A' )&&(ch<=' Z')".

Character data is stored in ASCII code inside the computer. English uppercase letters and lowercase letters are continuous in the ASCII code table. Capital letters A to Z are from 65 to 90, so as long as the variable ch is greater than A and less than Z, it is guaranteed to be an uppercase letter.

The above is the detailed content of What is the correct expression to determine whether the char variable ch is an uppercase letter?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn