Your IP : 216.73.216.48
# $EPIC: ascii,v 1.2 2000/12/12 04:24:43 jnelson Exp $
Synopsis:
$chr(<integer list>)
$ascii(<character list>)
Technical:
This pair of functions are used to convert between 8-bit characters and
their numeric equivalent (dependent on your locale). The $ascii()
function converts a string of characters to a word list of integers, and
$chr() converts a word list of integers into the corresponding string
of characters.
For $chr(), integers in the range 0..255 are accepted for input. For
$ascii() any arbitrary list of characters is accepted.
Practical:
These functions are used to convert from character values to their
numeric values, and back. One common use for these is to insert control
character into text without having to actually type them in; or to
check the case of a character.
Returns:
chr: space-delimited list of integer values
ascii: concatenated list of characters
Examples:
/* assume iso8859-1 character set */
$ascii(abcABC) returns "97 98 99 65 66 67"
$chr(1 2 3) returns "ABC" (ctrl-A, -B, -C)
$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.