Nanda Ardianto Nanda Ardianto - 1 year ago 283
Java Question

Too many characters in character literal - trying to check if my value is not within ASCII values '\0'

/*Visit only nodes with keys*/
if(root.alpha != '\0'){


as the title above says. How would I do this better? I'm trying to check if the character (root.alpha) is not within that spectrum. Thanks.

Answer Source

To check that the character is not within the range of the hexadecimal ASCII codes 48 and 92:

if (root.alpha < 0x48 || root.alpha > 0x92) {
    // ...

That is, not within range = less than the start or greater than the end.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download