DEFINITION MODULE String;
(*$ NameChk:=FALSE *)
(*
 * 26.8.90/bp
 * Module Str und Strings zusammengefasst und erweitert.
 * Alle Zuweisungen schließen garantiert mit 0C ab!
 *)
CONST
  first=0;
  last=-1;
  (* Resultat von FirstPos, LastPos, Occurs: *)
  noOccur=-1;

(* ---- Str + Erweiterungen ---- *)
PROCEDURE Length(str:ARRAY OF CHAR):INTEGER;
PROCEDURE LLength(str:ARRAY OF CHAR):LONGINT;

(* Nur TRUE, wenn noch 0C ans Ende paßt! *)
PROCEDURE CanCopyPos(VAR dest:ARRAY OF CHAR;
                     src:ARRAY OF CHAR;
                     destPos:LONGCARD):BOOLEAN;
PROCEDURE CopyPos(VAR dest:ARRAY OF CHAR;
                  src:ARRAY OF CHAR;
		  destPos:LONGCARD);

PROCEDURE CanCopy(VAR dest: ARRAY OF CHAR;
                  src:ARRAY OF CHAR):BOOLEAN;
PROCEDURE Copy(VAR dest: ARRAY OF CHAR;
                  src:ARRAY OF CHAR);

PROCEDURE CanConcat(VAR dest: ARRAY OF CHAR;
                    src:ARRAY OF CHAR):BOOLEAN;
PROCEDURE Concat(VAR dest: ARRAY OF CHAR;
                 src:ARRAY OF CHAR);

PROCEDURE Compare(str1,str2:ARRAY OF CHAR):LONGINT;

PROCEDURE FirstPos(str:ARRAY OF CHAR; from{2}:LONGCARD;
                   ch{3}:CHAR):LONGINT;
PROCEDURE LastPos(str:ARRAY OF CHAR; to{2}:LONGCARD;
                  ch{3}:CHAR):LONGINT;

PROCEDURE CapString(VAR str: ARRAY OF CHAR);
PROCEDURE ANSICap(ch{0}:CHAR):CHAR;
PROCEDURE ANSICapString(VAR str: ARRAY OF CHAR);

(* ---- Strings + Erweiterungen ---- *)
PROCEDURE Occurs(VAR str:ARRAY OF CHAR; from:INTEGER;
		token:ARRAY OF CHAR;
		caseSens:BOOLEAN):INTEGER;

PROCEDURE CanInsert(VAR str: ARRAY OF CHAR;
                    at:INTEGER;
                    token:ARRAY OF CHAR):BOOLEAN;

(* ACHTUNG: Wenn str und token identisch: Fehler! *)
PROCEDURE Insert(VAR str: ARRAY OF CHAR;
		 at:INTEGER; token:ARRAY OF CHAR);

PROCEDURE Delete(VAR str:ARRAY OF CHAR;
                 start,length:INTEGER);

PROCEDURE CanCopyPart(VAR dest:ARRAY OF CHAR;
                      src:ARRAY OF CHAR;
                      start,length:INTEGER):BOOLEAN;
PROCEDURE CopyPart(VAR dest:ARRAY OF CHAR;
                  src:ARRAY OF CHAR;
		  start,length:INTEGER);

PROCEDURE ComparePart(VAR str:ARRAY OF CHAR;
		start, length:INTEGER;
		token:ARRAY OF CHAR;
		caseSens:BOOLEAN):INTEGER;

(* ---- neu ---- *)

PROCEDURE CanConcatChar(VAR str:ARRAY OF CHAR;
                        ch:CHAR):BOOLEAN;

PROCEDURE ConcatChar(VAR str:ARRAY OF CHAR; ch:CHAR);

PROCEDURE DeleteChar(VAR str:ARRAY OF CHAR; pos:INTEGER);

PROCEDURE BStrToStr(VAR str:ARRAY OF CHAR);
PROCEDURE StrToBStr(VAR str:ARRAY OF CHAR);

END String.
