ArrayOfChar

Operations on ARRAY OF CHAR. All operations sets the NUL termination if possible

Procedures

Clear

Set length of string to 0

PROCEDURE Clear* (VAR str : ARRAY OF CHAR);

NulTerminate

Ensure string is NUL terminated

PROCEDURE NulTerminate* (VAR str : ARRAY OF CHAR);

Capacity

Return capacity of the array

PROCEDURE Capacity* (str- : ARRAY OF CHAR): LONGINT;

Length

Find length of C style NUL terminated string or length of array if not NUL terminated

PROCEDURE Length* (str-: ARRAY OF CHAR) : LONGINT ;

Assign

Assign src to dst

PROCEDURE Assign* (VAR dst : ARRAY OF CHAR; src- : ARRAY OF CHAR);

FillChar

Fill string dst with char chr

PROCEDURE FillChar* (VAR dst : ARRAY OF CHAR; chr : CHAR);

AppendChar

Append ch to dst

PROCEDURE AppendChar* (VAR dst : ARRAY OF CHAR; ch : CHAR);

Append

Append src to dst

PROCEDURE Append* (VAR dst : ARRAY OF CHAR; src- : ARRAY OF CHAR);

Extract

Extract substring to dst from src from start position and count length.

PROCEDURE Extract* (VAR dst : ARRAY OF CHAR; src- : ARRAY OF CHAR; start, count: LONGINT);

Compare

Compare strings left and right with option IgnoreCase set to ignore case.

  • 0 if left = right

  • -1 if left < right

  • +1 if left > right

PROCEDURE Compare* (left-, right- : ARRAY OF CHAR; IgnoreCase := FALSE : BOOLEAN): INTEGER;

IndexChar

Index of char in str. One based index with zero indicating char not found

PROCEDURE IndexChar* (chr : CHAR; str- : ARRAY OF CHAR; start := 0 : LONGINT): LONGINT;

Index

Index of pattern in str. -1 indicating pattern not found. Note : This is a very simple implementation.

PROCEDURE Index* (pattern-, str-: ARRAY OF CHAR; start := 0 : LONGINT): LONGINT;

Index

Index of pattern in str. -1 indicating pattern not found.

This is the TwoWay algorithm
PROCEDURE Index* (pattern-, str-: ARRAY OF CHAR; start := 0 : LONGINT): LONGINT;

Delete

Delete count characters from dst starting from start.

PROCEDURE Delete* (VAR dst: ARRAY OF CHAR; start, count: LONGINT);

Insert

Insert src into dst at start.

PROCEDURE Insert* (VAR dst : ARRAY OF CHAR; src- : ARRAY OF CHAR; start: LONGINT);

Replace

Replace old string with new string starting at index start (defaults to 0).

PROCEDURE Replace* (VAR dst: ARRAY OF CHAR; old-, new-: ARRAY OF CHAR; start := 0 : LONGINT);

LeftTrim

Remove white space & control characters from left side of string.

PROCEDURE LeftTrim* (VAR dst: ARRAY OF CHAR);

RightTrim

Remove white space & special characters from right side of string.

PROCEDURE RightTrim* (VAR dst: ARRAY OF CHAR);

Trim

Remove white space & special characters from right & left side of string.

PROCEDURE Trim* (VAR dst: ARRAY OF CHAR);

LeftPad

Left justified of length width with ch (defaults to SPC).

PROCEDURE LeftPad* (VAR dst: ARRAY OF CHAR; width : LONGINT; ch := ' ' : CHAR);

RightPad

Right justified of length width with ch (defaults to SPC).

PROCEDURE RightPad* (VAR dst: ARRAY OF CHAR; width : LONGINT; ch := ' ' : CHAR);

LowerCase

Transform string inplace to lower case (Only takes into account the ASCII characters).

PROCEDURE LowerCase* (VAR dst: ARRAY OF CHAR);

UpperCase

Transform string inplace to upper case (Only takes into account the ASCII characters).

PROCEDURE UpperCase* (VAR dst: ARRAY OF CHAR);

Capitalize

Capitalize string inplace. (Only takes into account the ASCII characters).

PROCEDURE Capitalize* (VAR dst: ARRAY OF CHAR);

StartsWith

Check if string str starts with prefix.

PROCEDURE StartsWith* (str-, prefix- : ARRAY OF CHAR): BOOLEAN;

EndsWith

Check if string str ends with postfix.

PROCEDURE EndsWith* (str-, postfix- : ARRAY OF CHAR): BOOLEAN;

Match

Return TRUE if patter matches str.

  • ? mathches a single character

  • * mathches any sequence of characters including zero length

PROCEDURE Match* (str- : ARRAY OF CHAR; pattern- : ARRAY OF CHAR; IgnoreCase := FALSE : BOOLEAN): BOOLEAN;

Hash

Hash value of array (32bit FNV-1a)

PROCEDURE Hash* (src- : ARRAY OF CHAR; hash :=  0811C9DC5H : Type.CARD32): Type.CARD32;