Site Tools


ascii

# $EPIC: ascii.txt,v 1.2 2006/08/29 20:58:41 jnelson Exp $

Synopsis:

$ascii(<character list>)

Technical:

The ascii function converts a sequence of characters into a word list of codepoints. Because EPIC only supports latin-1 at this time, all of the codepoints are 0 to 255 (strictly 1 byte per codepoint). If in the future epic supports UTF8 or something like that, codepoints greater than 255 might be returned.

You can use the chr function to convert a word list of codepoints into a sequence of characters. The same caveats about encoding applies.

By definition, the ascii and chr functions are symmetrically reverse operations of each other.

Examples:

/* assume iso8859-1 character set */
$ascii(abcABC)                     returns "97 98 99 65 66 67"
$chr($ascii(abcABC))               returns "abcABC"

Other Notes:

Some characters with the high bit set will return negative numeric values from $ascii(). Add 256 to this negative value to get its positive equivalent. The $chr() function will accept either.

ascii.txt · Last modified: 2006/08/29 20:58 by 127.0.0.1