fmt_custom_encode [function]

fmt_custom_encode( string text, string class, string prefix, int format, int mindigits = 0, string postfix = "" )

encodes a custom format (selected character codes to numeric version)

Every character (byte) from text that matches class is converted to the following format:

format must be one of:

Use case example - encode a string for C/C++ source code output:

// character class:
// - '^' - invert class (exclude the following characters/ranges)
// - <space>, '!' - characters to exclude (first printable characters, before quote)
// - '#-~' - character range to exclude (other printable characters, after quote)
// the extra set of quotes around hex code prevent hyperactive parsers from thinking ..
// .. that the following characters might be a part of the hex code
fmt_custom_encode( 'some text', "^ !#-~", '""\\x', FMT_NUMBER_HEX, 2, '""' )