Previous Up Next

String

The \(\rm String\) class provides strings. The following methods are defined:

length() : Int
concat(s : String) : String
substr(i : Int, l : Int) : String

The method \(\rm length\) returns the length of the \(\rm self\) parameter. The method \(\rm concat\) returns the string formed by concatenating \(\rm s\) after \(\rm self\). The method \(\rm substr\) returns the substring of its \(\rm self\) parameter beginning at position \(\rm i\) with length \(\rm l\); string positions are numbered beginning at 0. A runtime error is generated if the specified substring is out of range. Substring errors are always reported as taking place on line 0.

The default initialization for variables of type \(\rm String\) is \(\rm \LQT \RQT\) (not \(\rm void\)). It is an error to inherit from or redefine \(\rm String\).

Previous Up Next