News flash: I'm going to Australia in February, so this Web site may be switched off at any time.
Before we look at Icon's functions for analyzing strings, we must
first understand the idea of the cset
, which is a basic
Icon type that describes sets of characters.
Csets are for describing generic types of characters, such as ``letters,'' ``digits,'' and ``punctuation marks.'' Mathematically, a cset is a subset of the external character set (such as ASCII).
For example, suppose we want to talk about ``delimiter''
characters, where a delimiter is either a period, comma, or
slash. This Icon statement would define a variable called
delim
as this cset:
delim := '.,/';Characters written between single quotes (
''
) define
a cset. A number of csets are predefined in Icon:
&digits
'' is the cset of digits from 1 to 9.
&letters
'' is the cset of all letters, both
uppercase and lowercase.
&lcase
'' is the cset of lowercase letters,
and ``&ucase
'' is the cset of uppercase letters.
john@nmt.edu