String

Dynamic STRING type. Strings are always NUL terminated and possible resized to accomodate content.

For further operations on STRING type check ArrayOfChar.

Types

STRING* = Type.STRING;

Procedures

Reserve

PROCEDURE Reserve* (VAR dst :STRING; capacity : LENGTH; Copy : BOOLEAN);

Assign

Assign src to dst.

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

AppendChar

Append ch to dst.

PROCEDURE AppendChar* (VAR dst : STRING; ch : CHAR);

Ln

Append NewLine to dst.

PROCEDURE Ln*(VAR dst: STRING);

Append

Append src to dst.

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

Extract

Extract substring from src starting at start and count length.

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

Compare

Compare strings left and right.

  • 0 if left = right

  • -1 if left < right

  • +1 if left > right

PROCEDURE Compare* (left-, right- : STRING): INTEGER;

Equal

Test if left and right is equal.

PROCEDURE Equal* (left-, right- : STRING): BOOLEAN;

Insert

Insert src into dst at start

PROCEDURE Insert* (VAR dst : STRING; src : ARRAY OF CHAR; start: LENGTH);

Replace

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

PROCEDURE Replace* (VAR dst: STRING; old-, new-: ARRAY OF CHAR; start : LENGTH);

New

Assign to a new string and return

PROCEDURE New* (str-: ARRAY OF CHAR): STRING;

S

Assign to existing string and return reference

PROCEDURE S* (VAR dst: STRING; str-: ARRAY OF CHAR): STRING;

Duplicate

Duplicate string

PROCEDURE Duplicate* (VAR dst: STRING; src-: STRING);

Dispose

Dispose string

PROCEDURE Dispose* (VAR str: STRING);

FormatString

Format ARRAY OF CHAR.

  • width : Total field with. Can overflow if string is bigger.

  • prec : The number of characters in string to add (if prec > 0)

The alignment formatting flags are Left, Right & Center . The Upper flag will make the whole string upper case. The Alt flag will capitalize the string.

PROCEDURE FormatString*(VAR dst: STRING; str- : ARRAY OF CHAR; width, prec: INTEGER; flags: SET);

FormatInteger

Format HUGEINT.

  • width : Total field with. Can overflow if number is bigger.

The alignment formatting flags are Left, Right & Center . The Zero flag fills with 0 of the formatting is right aligned. The Spc flag fills in a blank character for + if the number is positive. The Sign flag fills in a + character if the number is positive. If both Spc and Sign are given then Sign precedes.

PROCEDURE FormatInteger*(VAR dst: STRING; value : HUGEINT; width: LENGTH; flags: SET);

FormatReal

Format REAL.

  • prec : Precision or zero for default value.

  • width : Total field with. Can overflow if number is bigger.

  • flags : Exp or Fix formatting supported.

The alignment formatting flags are Left, Right & Center . The Spc flag fills in a blank character for + if the number is positive. The Sign flag fills in a + character if the number is positive. If both Spc and Sign are given then Sign precedes.

PROCEDURE FormatReal*(VAR dst: STRING; value : REAL; prec: INTEGER; width: LENGTH; flags: SET);

FormatCardinal

Format HUGECARD.

  • base : Number base.

  • width : Total field with. Can overflow if number is bigger.

The alignment formatting flags are Left, Right & Center . The Zero flag fills with 0 of the formatting is right aligned. The Upper flag the hex decimal letters are upper case.

The Alt flags prefix binary (base 2) numbers with 0b, octal numbers (base 8) with 0o and hex decimal numbers with either 0x or 0X depending on the Upper flag.

PROCEDURE FormatCardinal*(VAR dst: STRING; value : HUGECARD; base, width: INTEGER; flags: SET);

FormatDateTime

Format DATETIME according to format string arguments:

  • %a : Weekday abbreviated name : Mon .. Sun

  • %A : Weekday full name : Monday .. Sunday

  • %w : Weekday as number : 0 .. 6

  • %b : Month abbreviated name : Jan .. Des

  • %B : Month full name : Januar .. Desember

  • %Y : Year without century : 00 - 99

  • %y : Year with century : 0000 - 9999

  • %m : Month zero-padded : 00 - 12

  • %d : Day of the month zero-padded : 01 - XX

  • %W : Week of the year zero-padded : 01 - 53

  • %H : Hour (24-hour clock) zero-padded : 00 - 23

  • %I : Hour (12-hour clock) zero-padded : 1 - 12

  • %p : AM or PM

  • %M : Minute zero-padded : 00 - 59

  • %S : Second zero-padded : 00 - 59

  • %f : Milliseconds zero-padded : 000 - 999

  • %Z : Timezone : UTC+/-

  • %% : Literal % char

Other characters are copied to output.

PROCEDURE FormatDateTime*(VAR dst: STRING; value : DateTime.DATETIME; fmt- : ARRAY OF CHAR);

Hash

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

PROCEDURE Hash* (src- : STRING): LENGTH;