home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Misc / MODULAV2GERMAN.DMS / in.adf / Def.zoo / Str.def < prev    next >
Encoding:
Modula Definition  |  1988-11-29  |  1.5 KB  |  55 lines

  1. DEFINITION MODULE Str;
  2. (* 29.11.88 / cn, red & ms *)
  3.  
  4. CONST
  5.  first = 0;        (* first: Use where you like *)
  6.  noOccur = -1;        (* noOccur: May be returned by Search *)
  7.  last = -1;
  8.  
  9. PROCEDURE Length(st: ARRAY OF CHAR): LONGCARD;
  10. (*
  11.  * Compute length of string actually used. The string may be terminated by
  12.  * ASCII.nul. [0 <= Length(str) <= (HIGH(st)+1)]
  13.  *)
  14.  
  15. PROCEDURE CopyPos(VAR dest: ARRAY OF CHAR;
  16.                   src: ARRAY OF CHAR; destPos: LONGCARD);
  17. (*
  18.  * Copy <src> into <dest> starting at <dest[destPos]>. If dest cannot hold
  19.  * all characters from <src> the rest is cut off.
  20.  *)
  21.  
  22. PROCEDURE Copy(VAR dest: ARRAY OF CHAR; src: ARRAY OF CHAR);
  23. (*
  24.  * This is just a call to CopyPos with <destPos> set to <first>.
  25.  *)
  26.  
  27. PROCEDURE Concat(VAR dest: ARRAY OF CHAR; src: ARRAY OF CHAR);
  28. (*
  29.  * Concatenates <dest> and <src> into <dest>.
  30.  *)
  31.  
  32. PROCEDURE Compare(s1,s2: ARRAY OF CHAR): LONGINT;
  33. (*
  34.  * Compares <s1> and <s2>. Returns zero if the strings are equal, a
  35.  * positive result if s1 > s2 and a negative result if s1 < s2 .
  36.  * The absolute value of the result is the number of matching characters+1
  37.  *)
  38.  
  39. PROCEDURE FirstPos(st: ARRAY OF CHAR; from: LONGINT; ch: CHAR): LONGINT;
  40. (*
  41.  * FirstPos returns the first occurence of ch in string starting at <from>.
  42.  *)
  43.  
  44. PROCEDURE LastPos(st: ARRAY OF CHAR; to: LONGINT; ch: CHAR): LONGINT;
  45. (*
  46.  * LastPos returns the last occurence of ch in string ending at <to>.
  47.  *)
  48.  
  49. PROCEDURE CapString(VAR st: ARRAY OF CHAR);
  50. (*
  51.  * Capitalize all characters in the argument string.
  52.  *)
  53.  
  54. END Str.
  55.