Skip to content Skip to sidebar Skip to footer

Using Comparison Operators For Hex Values

I want to create a function that performs a certain task only when a hex value indicates an upper or lower case letter, i.e., when the hex code is between 20 and 7A. Is there a way

Solution 1:

yes ... you just throw a 0x and it becomes numeric ....

or int("7A",16) == 0x7A

0x20 <= a <= 0x7A you can also chain comparison operators like this (which translates roughly to "is a between val1 and val2")

Post a Comment for "Using Comparison Operators For Hex Values"