next up previous contents
Next: The period Operator Up: Simple types Previous: Matrices

   
Strings

Any set of characters (including no characters) enclosed by the single quote symbol (') is defined to be of type string in Darwin.

> thoughts := '';                               # an empty string
thoughts := 
> MyName := 'mike hallett';                     # a string
MyName := mike hallett
> MyAge := 'twenty eight';                      # a string
MyAge := twenty eight

Each item of type string is indexed and its individual components can be accessed in the same manner as one accesses the individual components of an array.

> MyName[6];
h
> MyAge[2];
w



 

Gaston Gonnet
1998-09-15