CHARACTER CONSTANTS

A character constant is the binary value of a specific ASCII character. Character constants are used as a convenient way of refering to characters without looking up the binary value of the required character. Using character constants has a distinct advantage over using the binary value directly. In particular the value is easier to read and verify when it is encountered in the source code.

XCSB character constants are written as 0'C' (where C is the ASCII character for which the programmer requires the binary equivalent)

e.g.

character
constant
hex
constant
decimal
constant
binary
constant
0'1'0x31490b_0011_0001
0'/'0x2F470b_0010_1111
0'A'0x41650b_0100_0001
Example of use in XCSB program
if x >= 0'a'  &&  x <= 0'z' then

	// got here if x is a lower case ASCII alpha character

else if x >= 0'A'  &&  x <= 0'Z' then

	// got here if x is an upper case ASCII alpha character

else if x >= 0'0'  &&  x <= 0'9' then

	// got here if x is a numeric ASCII digit

endif