ocean.text.convert.Hex

Utility functions for converting hexadecimal strings.

Members

Functions

handleRadix
bool handleRadix(cstring str, bool allow_radix, bool delegate(cstring) process)

Checks whether the radix in str (if present) matches the allow_radix flag, and passes the radix-stripped string to the provided delegate.

hexToBin
bool hexToBin(cstring str, ubyte[] buf)

Convert a string of hex digits to a byte array. This is only useful for RT strings. If one needs to do this with literals, x"FF FF" is a better approach.

hexToLower
mstring hexToLower(mstring str)

Converts any characters in the range A..F in a hex string to lower case (a..f).

isHex
bool isHex(cstring str, bool allow_radix)

Checks whether str is a hex string (contains only valid hex digits), optionally with radix specifier ("0x").

isHex
bool isHex(char c)

Checks whether a character is a valid hexadecimal digit.

Meta

License

Boost Software License Version 1.0. See LICENSE_BOOST.txt for details. Alternatively, this file may be distributed under the terms of the Tango 3-Clause BSD License (see LICENSE_BSD.txt for details).