home *** CD-ROM | disk | FTP | other *** search
Modula Definition | 1988-11-29 | 1.5 KB | 55 lines |
- DEFINITION MODULE Str;
- (* 29.11.88 / cn, red & ms *)
-
- CONST
- first = 0; (* first: Use where you like *)
- noOccur = -1; (* noOccur: May be returned by Search *)
- last = -1;
-
- PROCEDURE Length(st: ARRAY OF CHAR): LONGCARD;
- (*
- * Compute length of string actually used. The string may be terminated by
- * ASCII.nul. [0 <= Length(str) <= (HIGH(st)+1)]
- *)
-
- PROCEDURE CopyPos(VAR dest: ARRAY OF CHAR;
- src: ARRAY OF CHAR; destPos: LONGCARD);
- (*
- * Copy <src> into <dest> starting at <dest[destPos]>. If dest cannot hold
- * all characters from <src> the rest is cut off.
- *)
-
- PROCEDURE Copy(VAR dest: ARRAY OF CHAR; src: ARRAY OF CHAR);
- (*
- * This is just a call to CopyPos with <destPos> set to <first>.
- *)
-
- PROCEDURE Concat(VAR dest: ARRAY OF CHAR; src: ARRAY OF CHAR);
- (*
- * Concatenates <dest> and <src> into <dest>.
- *)
-
- PROCEDURE Compare(s1,s2: ARRAY OF CHAR): LONGINT;
- (*
- * Compares <s1> and <s2>. Returns zero if the strings are equal, a
- * positive result if s1 > s2 and a negative result if s1 < s2 .
- * The absolute value of the result is the number of matching characters+1
- *)
-
- PROCEDURE FirstPos(st: ARRAY OF CHAR; from: LONGINT; ch: CHAR): LONGINT;
- (*
- * FirstPos returns the first occurence of ch in string starting at <from>.
- *)
-
- PROCEDURE LastPos(st: ARRAY OF CHAR; to: LONGINT; ch: CHAR): LONGINT;
- (*
- * LastPos returns the last occurence of ch in string ending at <to>.
- *)
-
- PROCEDURE CapString(VAR st: ARRAY OF CHAR);
- (*
- * Capitalize all characters in the argument string.
- *)
-
- END Str.
-