Assume that x is a char variable that has been declared and already given a value. Write an expression whose value is true if and only if x is an hexadecimal (Base 16) digit (0-9 plus A-F or a-f).

Assume that x is a char variable that has been declared and already given a value.  Write an expression whose value is true if and only if x is an hexadecimal (Base 16) digit (0-9 plus A-F or a-f).

LANGUAGE: Visual Basic

CHALLENGE:

Assume that x is a char variable that has been declared and already given a value. Write an expression whose value is true if and only if x is an hexadecimal (Base 16) digit (0-9 plus A-F or a-f).

SOLUTION:

((x >= "A") And (x <= "F")) Or ((x >= "a") And (x <= "f")) Or ((x >= "0") And (x <= "9"))


Add comment