Module Strings Reference

This module provides a set of operations on strings (character arrays), that must contain 0X as a terminator.

All positions in strings start at 0.

Constants

This section is empty.

Types

This section is empty.

Variables

This section is empty.

Procedures

PROCEDURE Append (VAR s: ARRAY OF CHAR; VAR dst: ARRAY OF CHAR);

Appends string s to the end of string dst.

Has the same effect as Insert(s, Length(s), dst).

PROCEDURE Cap (VAR s: ARRAY OF CHAR);

Replaces each lower case latin letter in s by its upper case equivalent.

PROCEDURE Copy (VAR src: ARRAY OF CHAR; VAR dst: ARRAY OF CHAR);

Copies src to dst.

If the size of dst is not large enough to hold the copy, the result is truncated so that dst is always terminated with a 0X.

Has the same effect as Extract(src, 0, LEN(dst), dst).

PROCEDURE Delete (VAR s: ARRAY OF CHAR; pos: INTEGER; n: INTEGER);

Deletes n characters from s starting at position pos

(0 <= pos < Length(s)).

If n > Length(s) - pos, the new length of s is pos.

PROCEDURE Extract (VAR src: ARRAY OF CHAR; pos: INTEGER; n: INTEGER; VAR dst: ARRAY OF CHAR);

Extracts a substring dst with n characters from position pos in src

(0 <= pos < Length(src)).

If n > Length(src) - pos, dst is only the part of src from pos to Length(src) - 1.

If the size of dst is not large enough to hold the result of the operation, the result is truncated so that dst is always terminated with a 0X.

PROCEDURE Insert (VAR src: ARRAY OF CHAR; pos: INTEGER; VAR dst: ARRAY OF CHAR);

Inserts the string src into the string dst at position pos

(0 <= pos <= Length(dst))

If pos >= Length(dst), src is appended to dst.

If the size of dst is not large enough to hold the result of the operation, the result is truncated so that dst is always terminated with a 0X.

PROCEDURE Length (VAR s: ARRAY OF CHAR): INTEGER;

Returns the number of characters in s up to and excluding the first 0X

PROCEDURE Match (VAR string: ARRAY OF CHAR; VAR pattern: ARRAY OF CHAR): BOOLEAN;

Performs a pattern match on a given string. Returns TRUE on match.

Parameter pattern may include wildcard characters '*'.

PROCEDURE Pos (VAR pattern: ARRAY OF CHAR; VAR s: ARRAY OF CHAR; pos: INTEGER): INTEGER;

Returns the position of the first occurrence of pat in s after position pos (inclusive).

If pat is not found, returns -1.

PROCEDURE Replace (VAR src: ARRAY OF CHAR; pos: INTEGER; VAR dst: ARRAY OF CHAR);

Has the same effect as Delete(dst, pos, Length(src)) followed by an Insert(src, pos, dst)