2.1 Strings

Strings are lists of characters, with characters being small integers between 0 and 255. For the coding of characters with integers we use the ISO 8859-1 standard [ISO87].

There are special operations on strings, like testing whether a given value X is a string, by {IsString X}. For transforming strings into atoms, integers, or floats the procedures

are provided. For testing whether a given string can be transformed into an atom, integer, or float, the procedures

are provided.

In addition, all functionality provided by the module List is applicable. It is especially useful in combination with the functionality provided by the module Char.

Suppose that after reading or receiving a string S="C@l!3E4aN#61!" all characters which are neither uppercase nor lowercase letters must be filtered out. This is achieved by using a combination of Filter and Char.isAlpha. Feeding:

<{Filter S}>=
{Browse {String.toAtom {Filter S Char.isAlpha}}}

will show the cleaned information in the browser window.

Instead of creating an atom from the cleaned string, the browser offers functionality to display strings directly in a convenient form. The functionality can be selected in the Representation, Type option, see also ``The Oz Browser''. For Example,

<{Browse S}>=
{Browse {Filter S Char.isAlpha}}

displays in the browser window the character sequence "ClEaN".

Remember that character codes for letters are syntactically supported. For instance, the string

"hi there"

can be written equivalently as

[&h &i  &t &h &e &r &e]


Christian Schulte
Version 1.4.0 (20080702)