检查是否char是大写字母 [英] Checking if char is uppercase letter
本文介绍了检查是否char是大写字母的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要检查,如果一个字符是大写字母。
现在我知道,我需要先 CMP人,A
,如果大于或等于,我需要 CMP人,Z
,然后如果是小于或等于,那么它就是一个大写字母。
任何想法如何,我可以做两个比较,而无需跳转标签插图中?
I need to check if a char is an uppercase letter.
Now I know that I need to first cmp al, "A"
, and if is above or equal, I need to cmp al, "Z"
and then if it is less or equal, then it is an uppercase letter.
Any idea how I can do the two comparisons without having to jump labels inbetween?
推荐答案
减去'A'
然后做无符号比较'Z'- 'A'
。
sub al, 'A'
cmp al, 'Z'-'A'
jbe uppercase
请注意,这当然则会覆盖的人
注册。
Note that this of course clobbers the al
register.
这篇关于检查是否char是大写字母的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文