Function isHex

  • Checks if a string is a hexadecimal number. Understands prefixes for hex colors, hex decimal and regexp unicode hex.

    Parameters

    • s: string

      The string to be tested.

    Returns boolean

    A boolean indicating whether the string is a hexadecimal number.

    Remarks

    This function uses a regular expression to test if the input string is a hexadecimal number.

    Example

    isHex('123abc');
    //=> true
    isHex('123g');
    //=> false

Generated using TypeDoc