Product Site

7.4.83. XRANGE (Hexadecimal Range)

Returns a string of all valid 1-byte encodings (in ascending order) between and including the values start and end, or a character sequence representing a POSIX character class name. Any number of start / end bytes and character class names can be specified, and all resulting sequences are returned as a concatenated string.

The default value for start is '00'x, and the default value for end is 'ff'x. If start is greater than end, the values wrap from 'ff'x to '00'x. If specified, start and end must be single characters.

The characters in a sequence representing a POSIX character class name are returned in ascending order. The following POSIX character class names can be specified:
NameDescriptionReturned sequence
ALNUMAlphanumeric characters0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz
ALPHAAlphabetic charactersABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz
BLANKSpace and tab'09 20'x
CNTRLControl characters'00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 7F'x
DIGITDigits0123456789
GRAPHVisible characters!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_` abcdefghijklmnopqrstuvwxyz{|}~
LOWERLowercase lettersabcdefghijklmnopqrstuvwxyz
PRINTVisible characters and space character !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_` abcdefghijklmnopqrstuvwxyz{|}~
PUNCTPunctuation characters!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~
SPACEWhitespace characters'09 0A 0B 0C 0D 20'x
UPPERUppercase lettersABCDEFGHIJKLMNOPQRSTUVWXYZ
XDIGITHexadecimal digits0123456789ABCDEFabcdef

Here are some examples:
Example 7.112. Builtin function XRANGE
XRANGE("a", "f")                     --> "abcdef"
XRANGE('03'x, '07'x)                 --> '0304050607'x
XRANGE(, '04'x)                      --> '0001020304'x
XRANGE('FE'x, '02'x)                 --> 'FEFF000102'x
XRANGE("t", "t", "h", "i", "r", "t") --> "thirst"
XRANGE('xdigit')                     --> "0123456789ABCDEFabcdef"
XRANGE("a", "f", "A", "F", "digit")  --> "abcdefABCDEF0123456789"