1 DEFINITION MODULE Strings;
3 Module: String manipulations
4 Author: Ceriel J.H. Jacobs
5 Version: $Id: Strings.def,v 1.3 1994/06/24 12:50:00 ceriel Exp $
7 (* Note: truncation of strings may occur if the user does not provide
8 large enough variables to contain the result of the operation.
11 (* Strings are of type ARRAY OF CHAR, and their length is the size
12 of the array, unless a 0-byte occurs in the string to indicate the
16 PROCEDURE Assign(source: ARRAY OF CHAR; VAR dest: ARRAY OF CHAR);
17 (* Assign string source to dest
20 PROCEDURE Insert(substr: ARRAY OF CHAR; VAR str: ARRAY OF CHAR; inx: CARDINAL);
21 (* Insert the string substr into str, starting at str[inx].
22 If inx is equal to or greater than Length(str) then substr is appended
26 PROCEDURE Delete(VAR str: ARRAY OF CHAR; inx, len: CARDINAL);
27 (* Delete len characters from str, starting at str[inx].
28 If inx >= Length(str) then nothing happens.
29 If there are not len characters to delete, characters to the end of the
33 PROCEDURE Pos(substr, str: ARRAY OF CHAR): CARDINAL;
34 (* Return the index into str of the first occurrence of substr.
35 Pos returns a value greater than HIGH(str) of no occurrence is found.
38 PROCEDURE Copy(str: ARRAY OF CHAR;
40 VAR result: ARRAY OF CHAR);
41 (* Copy at most len characters from str into result, starting at str[inx].
44 PROCEDURE Concat(s1, s2: ARRAY OF CHAR; VAR result: ARRAY OF CHAR);
45 (* Concatenate two strings.
48 PROCEDURE Length(str: ARRAY OF CHAR): CARDINAL;
49 (* Return number of characters in str.
52 PROCEDURE CompareStr(s1, s2: ARRAY OF CHAR): INTEGER;
53 (* Compare two strings, return -1 if s1 < s2, 0 if s1 = s2, and 1 if s1 > s2.