Version II.0, February 1979
Returns the integer value of the length of the STRING.
Example:
Will print:GEESTRING := '1234567'; WRITELN(LENGTH(GEEZTRING), ' ', LENGTH(''));
7 0
This function returns the position of the first occurrence of the pattern in SOURCE to be scanned. The INTEGER value of the position of the first character in the matched pattern will be returned; or if the pattern was not found, zero will be returned.
Example:
STUFF := 'TAKE THE BOTTLE WITH A METAL CAP'; PATTERN := 'TAL'; WRITELN(POS(PATTERN, STUFF));
Will print:
26
There may be any number of source strings separated by commas. This function returns a string which is the concatenation of all the strings passed to it.
Example:
SHORTSTRING := 'THIS IS A STRING'; LONGSTRING := 'THIS IS A VERY LONG STRING.'; LONGSTRING := CONCAT('START ', SHORTSTRING, '-' , LONGSTRING); WRITELN(LONGSTRING);
START THIS IS A STRING-THIS IS A VERY LONG STRING.
This function returns a string containing SIZE characters copied from SOURCE starting at the INDEXth position in SOURCE.
Example:
TL := 'KEEP SOMETHING HERE'; KEPT := COPY(TL, POS('S', TL), 9); WRITELN(KEPT);
Will print:
SOMETHING
This procedure removes SIZE characters from DESTINATION starting at the INDEX specified.
Example:
OVERSTUFFED := 'THIS STRING HAS FAR TOO MANY CHARACTERS IN IT.'; DELETE(OVERSTUFFED, POS('HAS', OVERSTUFFED) + 3, 8); WRITELN(OVERSTUFFED);
Will print:
THE STRING HAS MANY CHARACTERS IN IT.
This inserts SOURCE into DESTINATION at the INDXth position.
Example:
Will print:ID := 'INSERTIONS'; MORE := ' DEMONSTRATE'; DELETE(MORE, LENGTH(MORE), 1); INSERT(MORE, ID, POS('IO', ID)); WRITELN(ID);
INSERT DEMONSTRATIONS
This converts the long integer LONG into a string. The resulting string is placed in DESTINATION. See section 3.3.3 for more about the use of long integers.
Example:
INTLONG := 102039503; STR(INTLONG, INTSTRING); INSERT('.' , INTSTRING, PRED(LENGTH(INTSTRING))); WRITELN('$' ,INTSTRING);
Will print:
$1020395.03
1..LENGTH(string)Accessing the string outside this range will have unpredictable results if range-checking is off or cause a run-time error (1) if range checking is on.