
+ integer u8 unsigned 1 {
    use Number

    + fn is_ascii() bool {
        return this < 128
    }
    + fn is_hex() bool {
        return (this >= '0' && this <= '9') || (this >= 'a' && this <= 'f') || (this >= 'A' && this <= 'F')
    }
    + fn is_octal() bool {
        return (this >= '0' && this <= '7')
    }
    + fn is_number() bool {
        return this >= '0' && this <= '9'
    }
    + fn is_lower() bool {
        return this >= 'a' && this <= 'z'
    }
    + fn is_upper() bool {
        return this >= 'A' && this <= 'Z'
    }
    + fn is_alpha() bool {
        return (this >= 'A' && this <= 'Z') || (this >= 'a' && this <= 'z')
    }
    + fn is_alpha_numeric() bool {
        return (this >= 'A' && this <= 'Z') || (this >= 'a' && this <= 'z') || (this >= '0' && this <= '9')
    }
    + fn is_space_or_tab() bool {
        return (this == ' ' || this == '\t')
    }
    // None newline HTML whitespace
    + fn is_html_spacing() bool {
        return (this == ' ' || this == '\t' || this == '\f')
    }
    // Bytes that are whitespace in the HTML protocol
    + fn is_html_whitespace() bool {
        return (this == ' ' || this == '\n' || this == '\r' || this == '\t' || this == '\f')
    }
    + fn is_whitespace() bool {
        return (this == '\t' || this == '\n' || this == '\v' || this == '\f' || this == '\r' || this == ' ')
    }
    + fn is_newline() bool {
        return this == '\n'
    }

    + fn hex_byte_to_hex_value() u8 {
        if this >= '0' && this <= '9' {
            return this - '0'
        }
        if this >= 'a' && this <= 'f' {
            return this - 'a' + 10
        }
        return this - 'A' + 10
    }

    + fn to_ascii_string() String {
        let str = String.make_empty(1)
        let data = str.data
        @ptrv(data, u8) = this
        return str
    }

    + fn unescape() u8 {
        let ch = this
        if (ch == 'n') {
            ch = '\n'
        } else if (ch == 'r') {
            ch = '\r'
        } else if (ch == 't') {
            ch = '\t'
        } else if (ch == 'f') {
            ch = '\f'
        } else if (ch == 'b') {
            ch = '\b'
        } else if (ch == 'v') {
            ch = '\v'
        } else if (ch == 'f') {
            ch = '\f'
        } else if (ch == 'a') {
            ch = '\a'
        } else if (ch == 'e') {
            ch = 27
        }
        return ch
    }
}
