Using csets to describe sets of characters in Icon |
|
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: