isHexString

Validates a hex string.

Checks whether all characters following an optional "0x" suffix are valid hexadecimal digits.

@safe pure nothrow @nogc
bool
isHexString
(
String
)
(
String hex
)
if ()

Parameters

hex String

hexdecimal encoded byte array

Return Value

Type: bool

true = if valid

Examples

assert(isHexString("0x0123456789ABCDEFabcdef"));
assert(isHexString("0123456789ABCDEFabcdef"));
assert(!isHexString("g"));
assert(!isHexString("#"));

Meta