This interface defines misc. TEXT manipulation routines.
INTERFACEText2 ; PROCEDURE CIEqual (a, b: TEXT): BOOLEAN;
ReturnsTRUE
ifa
andb
are equal when case is ignored.
PROCEDURE EqualSub (a: TEXT; READONLY b: ARRAY OF CHAR): BOOLEAN;
ReturnsTRUE
ifa
equalsb
.
PROCEDURE PrefixMatch (a, b: TEXT; len: CARDINAL): BOOLEAN;
Returns Text.Equal (Text.Sub (a, 0, Text.Length(b)), b)
.
PROCEDURE FindSubstring (a, b: TEXT): INTEGER;
Returns the indexx
ofa
such thatText.Sub(a, x, Text.Length(b))
equalsb
. Ifb
is not contained ina
,-1
is returned.
PROCEDURE FindBufSubstring (READONLY a: ARRAY OF CHAR; b: TEXT): INTEGER;
Returns the indexx
ofa
such thatSUBARRAY(a, x, Text.Length(b))
equalsb
. Ifb
is not contained ina
,-1
is returned.
PROCEDURE Trim (a: TEXT): TEXT;
Returns a
with any leading or trailing whitespace removed.
PROCEDURE Escape (a: TEXT): TEXT;
Returns a
with any backslashes or quotes escaped.
PROCEDURE EscapeHTML (a: TEXT): TEXT;
Returns a
with any special HTML characters escaped.
PROCEDURE ConvertNBSP (a: TEXT): TEXT;
Returns a
with any blanks turned into HTML non-breaking spaces
PROCEDURE FixExeName (a: TEXT): TEXT;
Ifa
contains blanks, return it wrapped in quotes. Otherwise, returna
unchanged.
END Text2.