Add function to check if a value is digit/xdigit.