Dec 242017
 
A LongString Manipulation Unit for Turbo Pascal 5.0 and above.
File SHLNGST1.ZIP from The Programmer’s Corner in
Category Pascal Source Code
A LongString Manipulation Unit for Turbo Pascal 5.0 and above.
File Name File Size Zip Size Zip Type
SHLNGSTR.DOC 38765 7449 deflated
SHLNGSTR.PAS 40745 6020 deflated
TEST.DAT 3078 655 deflated
TEST.EXE 26976 13019 deflated
TEST.PAS 7993 2342 deflated

Download File SHLNGST1.ZIP Here

Contents of the SHLNGSTR.DOC file





ShLngStr

A LongString Manipulation Unit for Turbo Pascal 5.0 and above.
(A SkyHawk development tool)

by

W. G. Madison and Associates, Ltd.
8425 Greenbelt Road
P.O. Box 898
Greenbelt, MD 20770
(301)552-7234
CIS 73240,342

Copyright 1991 Madison & Associates
All Rights Reserved

This unit and the associated .DOC and TEST.* files may
be freely copied and distributed, provided only that no
fee is charged for the package beyond a nominal copying
charge, and provided that the package is distributed IN
UNALTERED FORM. The sole exception to this latter re-
striction is that bona-fide clubs and user groups may
append text material to the documentation file, pro-
vided that any material appended is clearly identified
as to its source, its beginning, and its end.



INTRODUCTION

ShLngStr is a unit which provides the ability to manipulate
long strings (up to 65517 characters in length) using Turbo Pas-
cal. As such, it owes a debt to the Tp/OpASCIIZ units published
by TurboPower Software. Unlike the ASCIIZ manipulation units,
however, it carries its dynamic string length information in a
WORD at the beginning of the string. As such, it owes a debt to
the TpWrdStr unit written by Ken Henderson.

Both TpWrdStr and Tp/OpASCIIZ require a careful tradeoff on
the part of the user. They both typically allocate an "array of
char" in the data segment, in which the string data are stored;
thus they both define a MaxSize constant which must be carefully
balanced between providing a maximum string length long enough to
get the job done, and one which is small enough to avoid using up
the entire data segment.

ShLngStr avoids this problem. ShLngStr stores all of its
string data on the heap. When a variable is declared to be of
type LongString, this declaration establishes only a pointer in
the data segment. The LongString must then be initialized prior



to use. This initialization establishes a maximum allowable
string length, which may now vary from one LongString to the
next. Only the amount of heap space required for the initialized
maximum length is used. In this respect, the analog of a string
declaration of, for example, "var string[127];" has been pre-
served. Any of the procedures and functions in this unit will
observe the "declared" maximum length, and will adjust their
behavior appropriately

Thus, although a MaxLongString constant is included in the
unit, its value is set to the maximum allowable value (65517) and
is used only by lsInit.

Notwithstanding any of the above, the code in ShLngStr is
completely our own. Any bugs or deficiencies cannot be blamed on
anyone other than Madison & Associates.


PROCEDURE AND FUNCTION CALLS

There are currently approximately 80 procedures and func-
tions available within the ShLngStr unit. With few exceptions,
each procedure has a corresponding function; e.g., procedure
lsStr2LongString which converts a string to a LongString has a
corresponding function lsStr2LongStringF. It is important to
remember that the functions which return a LongString are return-
ing a pointer value rather than the contents of the LongString
itself. Failure to account for this can result in rather startl-
ing results on occasion.

Function results (i.e., these pointers) are stored in a ring
buffer which is allocated as needed, and is only reallocated when

the ring pointer comes back around to the specific element. By
default, the number of elements in the ring is set to 25. This
should be sufficient for most purposes; should it prove insuffi-
cient, set the typed constant RingSize to a larger value and re-
compile. Alternatively, RingSize can be increased at execution
time to a maximum value of 100; it should NOT be decreased at
execution time, however. It can be set to a maximum of 100
without affecting the size of the data segment.

Since the data associated with function (pointer) returns
are accessible only through elements in the ring buffer, and
since the heap space used to store these data will be released
when the ring element is required for reuse, it is important that
these data be used as quickly as possible. It ain't gonna be
around forever!

Thus, the rule of thumb should be "when in doubt, use
procedure calls."




- 2 -



CONSTANTS

MaxLongString = 65517;

The maximum length of a LongString.
______________________________

NotFound = 0;

Returned by the lsPos functions if a substring is not found.


TYPES

LongStringType = record
Length, {The dynamic length}
dLength : word; {The "declared" length}
lsData : array[1..1] of char;
end;

The record structure allocated on the heap for the storage
of LongString data.

NOTE: Because of the way in which LongStringType is defined,
if the ShLngStr unit is recompiled, range checking MUST be turned
off ({$R-}). Note also that redefining the lsData field as
array[1..MaxLongString] is apt to cause other problems. This
redefinition is definitely NOT RECOMMENDED!
______________________________

LongString = ^LongStringType;

The type expected as actual parameters to the routines in
this unit; also, the type returned by most of the functions.
______________________________

lsCompType = (Less, Equal, Greater);

The type returned by the LongString comparison functions.
______________________________

DelimSetType = set of char;

The type of the set of characters which the GetNext routines
will use as word delimiters.









- 3 -



VARIABLES AND TYPED CONSTANTS

RingSize : byte = 25;

The number of elements in the ring buffer, used to store
pointers returned by function calls of type LongString. This
value may be freely increased to a maximum value of 100 during
program execution, if necessary. Decreasing it, however, could
result in orphan blocks allocated on the heap, with no way to
recover them.
______________________________

DelimSet : DelimSetType = [#0..#32];

The typed constant used by the GetNext routines to determine
the end of a substring to be returned. It may be freely changed
during program execution.


NOMENCLATURE

All interfaced routines in ShLngStr have "ls" as the first
two characters of their name.

In the descriptive listings which follow, all routines hav-
ing similar functionality are grouped, and all routines within a
group have names which differ only in their respective suffixes;
e.g.,

lsDelAll
lsDelAllF
lsDelAllStr
lsDelAllStrF
lsDelAllUC
lsDelAllUCF
lsDelAllStrUC
lsDelAllStrUCF

These routines delete all occurrences of an entity from a
LongString. The basic procedure, lsDelAll, takes three parameters
of type LongString; respectively, the input LongString containing
the data to be scanned, the input LongString containing the
entity to be deleted from the first, and the output LongString
which is a copy of the input data LongString with all occurrences
of the second parameter deleted.

The "F" suffixes on the second, fourth, sixth, and eighth
names indicate a function call returning the output LongString.






- 4 -



The "Str" suffix on the third, fourth, seventh, and eighth
names indicates that the entity to be deleted is a string rather
than a LongString.

The "UC" suffix on the fifth through the eighth names
indicate that searching and deletion will be performed all in
upper case; the searching will not be case sensitive.

Some functions exist which do not have the "F" suffix. In
each such case, the returned value is a normal Turbo Pascal data
type, specifically, WORD or STRING.

In the following, the ordering is alphabetic by primary
routine name.


INTERFACED ROUTINES

lsCENTER

Declarations:
procedure lsCenter(A : LongString; Width : word; B : LongString);
function lsCenterF(A : LongString; Width : word) : LongString;

Purpose:
Return a LongString centered in a LongString of blanks with
specified width.

Examples:
If A contains "abcdefg"
then lsCenter(A, 13, B);
results in B containing " abcdefg "

Comments:
If the length of A already exceeds Width, A will be returned
unchanged.

See Also:
lsCenterCh
______________________________














- 5 -



lsCENTERCH

Declarations:
procedure lsCenterCh(A : LongString; Ch : Char;
Width : word; B : LongString);
function lsCenterChF(A : LongString; Ch : Char;
Width : word) : LongString;

Purpose:
Return a LongString centered in a LongString of Ch with spe-
cified width.

Examples:
If A contains "abcdefg"
then lsCenterCh(A, '+', 13, B);
results in B containing "+++abcdefg+++"

Comments:
If the length of A already exceeds Width, A will be returned
unchanged.

See Also:
lsCenter
______________________________

lsCHARSTR

Declarations:
procedure lsCharStr(Ch : Char; Len : word; A : LongString);
function lsCharStrF(Ch : Char; Len : word) : LongString;

Purpose:
Return a LongString of length Len filled with Ch.

Examples:
The call lsCharStr('+', 10, A);
results in A containing "++++++++++"

Comments:
If Len is greater than the maximum length of A, the returned
LongString will be equal in length to the maximum length of A.

See Also:
______________________________










- 6 -



lsCOMP

Declaration:
function lsComp(A1, A2 : LongString) : lsCompType;

Purpose:
Compares A1 to A2, returning LESS, EQUAL, or GREATER.

Examples:
For a normal COMPARE,
case lsComp(LS1, LS2) of
LESS : {Do This}
EQUAL : {Do That}
GREATER : {Do The Other}
end; {case lsComp}

For a case-insensitive COMPARE,
case lsComp(lsUpcaseF(LS1), lsUpcaseF(LS2)) of
LESS : {Do This}
EQUAL : {Do That}
GREATER : {Do The Other}
end; {case lsComp}

Comments:
This function completely implements the analog of the string
comparison operators of Turbo Pascal.

See Also:
______________________________

























- 7 -



lsCONCAT

Declarations:
procedure lsConcat(A, B, C : LongString);
function lsConcatF(A, B : LongString) : LongString;
procedure lsConcatLs2Str(S : string; A : LongString;
C : LongString);
function lsConcatLs2StrF(S : string; A : LongString)
: LongString;
procedure lsConcatStr2Ls(A : LongString; S : string;
C : LongString);
function lsConcatStr2LsF(A : LongString; S : string)
: LongString;

Purpose:
Concatenate the second parameter to the end of the first.

Examples:
If A contains "abcdefg"
and B contains "hijklmn"
then lsConcat(A, B, C);
results in C containing "abcdefghijklmn"

Comments:

See Also:
______________________________



























- 8 -



lsCOPY

Declarations:
procedure lsCopy(A : LongString; Start, Len : word;
B : LongString);
function lsCopyF(A : LongString;
Start, Len : word) : LongString;

Purpose:
Return a LongString substring of A. The substring begins at
position Start of A and will be of length Len.

Examples:
If A contains "abcdefg"
then lsCopy(A, 4, 3, B);
results in B containing "def"

If A contains "abcdefg"
then lsCopy(A, 4, 10, B);
results in B containing "defg"

Comments:
Start=1 for first char in A.

If Start > lsLength(A), an empty LongString will be
returned.

If Start+Len exceeds the length of A, the returned
LongString will be of length lsLength(A)-Start+1.

See Also:
______________________________






















- 9 -



lsCOUNT

Declarations:
function lsCount(A, Obj : LongString): word;
function lsCountStr(A : LongString; Obj : string) : word;
function lsCountStrUC(A : LongString; Obj : string) : word;
function lsCountUC(A, Obj : LongString): word;

Purpose:
Returns the total number of occurrences of Obj in A.

Examples:
if lsCountStrUC(MyLS, 'abc') <> NotFound then {Do something}

If A contains "abcdeabcdeabcde"
and Obj contains "BCD"
then lsCount(A, Obj)
returns NotFound ( = 0 )
but lsCountUC(A, Obj)
returns 3

Comments:
If Obj is not a substring of A, returns NotFound (i.e., 0).

See Also:
______________________________




























- 10 -



lsDELALL

Declarations:
procedure lsDelAll(A, Obj, B : LongString);
function lsDelAllF(A, Obj : LongString): LongString;
procedure lsDelAllStr(A : LongString; Obj : string;
B : LongString);
function lsDelAllStrF(A : LongString;
Obj : string) : LongString;
procedure lsDelAllStrUC(A : LongString; Obj : string;
B : LongString);
function lsDelAllStrUCF(A : LongString;
Obj : string) : LongString;
procedure lsDelAllUC(A, Obj, B : LongString);
function lsDelAllUCF(A, Obj : LongString): LongString;

Purpose:
Deletes all occurrences of Obj in A.

Examples:
See below.

Comments:
Should the deletion of Obj from A result in a new occurrence
of Obj in A, the new occurrence will not be deleted, e.g.,

If A contains 'aabcbcabcd'
and Obj contains 'abc'
then lsDelAll(A, Obj, B);
results in B containing 'abcd'
and not 'd'

To delete all occurrences including such incidental
occurrences, one would use, e.g.,

repeat
lsDelAll(A, Obj, A);
until lsCount(A, Obj) = 0;

See Also:
lsRepAll lsCount
______________________________












- 11 -



lsDELETE

Declarations:
procedure lsDelete(A : LongString; Start, Len : word; B :
LongString);
function lsDeleteF(A : LongString; Start, Len : word)
: LongString;

Purpose:
Delete Len characters of A, starting at position Start.

Examples:
If A contains "abcdefg"
then lsDelete(A, 4, 3, B);
results in B containing "abcg"

If A contains "abcdefg"
then lsDelete(A, 4, 10, B);
results in B containing "abc"

Comments:
If Start is greater than the length of A, B = A on output.

See Also:
lsDelAll lsRepAll
______________________________

lsDISPOSE

Declaration:
procedure lsDispose(var A : LongString);

Purpose:
Dispose of A, releasing its heap space.

Examples:
The call lsDispose(A);
results in All heap space associated with A is released
and A = nil

Comments:

See Also:
lsInit
______________________________









- 12 -



lsGETNEXT

Declarations:
procedure lsGetNext(LS1, LS2 : LongString);
function lsGetNextF(LS1 : LongString) : LongString;
procedure lsGetNextStr(LS1 : LongString; var S2 : string);
function lsGetNextStrF(LS1 : LongString) : string;

Purpose:
Returns the next substring of LS1 which is delimited by a
member of DelimSet.

Examples:
If A contains "abc def ghi jkl"
then the two calls
lsGetNext(A, B);
lsGetNext(A, B);
result in A containing " ghi jkl"
and B containing "def"

Comments:
On return, LS1 is returned untrimmed, but with the first
matching substring deleted.

See Also:
______________________________




























- 13 -



lsINIT

Declaration:
function lsInit(var A : LongString; L : word) : boolean;

Purpose:
"Declares" a LongString of maximum declared length L and
establishes space for it on the heap.

Examples:
The call if lsInit(A, 750) then {Do something};
results in a. A returned function value of "true"
b. 754 bytes being allocated on the heap.
(750 bytes for the character string,
4 overhead bytes.)
c. A containing a pointer to the heap space.

The call lsInit(A, 65518); {MaxLongString = 65517}
results in a. A returned function value of "false"
b. No space allocation on the heap.
c. A = nil

Comments:
Returns false if L is greater than MaxLongString.

If there is insufficient heap space to accommodate the
LongString, the program will terminate with a run-time error of
250 (if lsInit has been called directly) or 251 (if lsInit has
been called while attempting to allocate space on the ring
buffer.

See Also:
lsDispose
______________________________




















- 14 -



lsIOFF

Declaration:
procedure lsIoff;

Purpose:
Turns I/O checking off during execution of lsReadLn and
lsWriteLn.

Examples:
lsIoff;
lsReadLn(MyFile, MyLS);
if lsIoResult <> 0 then {Do something}
lsIon;

Comments:
lsIoff, lsIon, and lsIoResult MUST be used for LongString
I/O operations in place of $I-, $I+, and IoResult.

Emulates at execution time the action of the $I- compiler
directive, but only for LongString I/O. The default state is
"on".

If I/O checking is off (either by default or by a call to
lsIoff), lsIoResult MUST be called after each call to lsReadLn or
lsWriteLn. If I/O checking is on, and if an I/O error occurs, the
program will terminate with a run-time error. This action
duplicates the action of the IoResult function for normal I/O.

See Also:
lsIon lsIoResult
______________________________






















- 15 -



lsION

Declaration:
procedure lsIon;

Purpose:
Turns I/O checking on during execution of lsReadLn and
lsWriteLn.

Examples:
lsIoff;
lsReadLn(MyFile, MyLS);
if lsIoResult <> 0 then {Do something}
lsIon;

Comments:
lsIoff, lsIon, and lsIoResult MUST be used for LongString
I/O operations in place of $I-, $I+, and IoResult.

Emulates at execution time the action of the $I+ compiler
directive, but only for LongString I/O. The default state is
"on".

If I/O checking is off (either by default or by a call to
lsIoff), lsIoResult MUST be called after each call to lsReadLn or
lsWriteLn. If I/O checking is on, and if an I/O error occurs, the
program will terminate with a run-time error. This action
duplicates the action of the IoResult function for normal I/O.

See Also:
lsIoff lsIoResult
______________________________






















- 16 -



lsIORESULT

Declaration:
function lsIoResult : word;

Purpose:
Returns the IoResult of the last lsReadLn or lsWriteLn
performed, and clears the internal variable used to store the
value.

Examples:
lsIoff;
lsReadLn(MyFile, MyLS);
if lsIoResult <> 0 then {Do something}
lsIon;

Comments:
lsIoff, lsIon, and lsIoResult MUST be used for LongString
I/O operations in place of $I-, $I+, and IoResult.

If I/O checking is off (either by default or by a call to
lsIoff), lsIoResult MUST be called after each call to lsReadLn or
lsWriteLn. If I/O checking is on, and if an I/O error occurs, the
program will terminate with a run-time error. This action
duplicates the action of the IoResult function for normal I/O.

See Also:
lsIoff lsIon
______________________________

























- 17 -



lsINSERT

Declarations:
procedure lsInsert(A, Obj : LongString; Start : word;
B : LongString);
function lsInsertF(A, Obj : LongString; Start : word)
: LongString;
procedure lsInsertStr(A : LongString; Obj : string;
Start : word; B : LongString);
function lsInsertStrF(A : LongString; Obj : string;
Start : word) : LongString;

Purpose:
Insert Obj into A at position Start returning a new
LongString.

Examples:
If A contains "abcdef"
and Obj contains "ABC"
then lsInsert(A, Obj, 4, B);
results in B containing "abcABCdef"

Comments:
If Start > lsLength(A), no action is taken.

See Also:
lsDelete
______________________________

lsLEFTPAD

Declarations:
procedure lsLeftPad(A : LongString; Len : word; B : LongString);
function lsLeftPadF(A : LongString; Len : word) : LongString;

Purpose:
Left-pad the LongString in A to length Len with blanks,
returning a new LongString.

Examples:
If A contains "abc"
then lsLeftPad(A, 2, B);
results in B containing " abc"

Comments:
If Len < lsLength(A), A is returned truncated without
padding.

See Also:
lsLeftPadCh lsPad lsPadCh
______________________________



- 18 -



lsLEFTPADCH

Declaration:
procedure lsLeftPadCh(A : LongString; Ch : Char; Len : word;
B : LongString);
function lsLeftPadChF(A : LongString; Ch : Char; Len : word)
: LongString;

Purpose:
Left-pad the LongString in A to length Len with Ch,
returning a new LongString.

Examples:
If A contains "abc"
then lsLeftPad(A, '+', 2, B);
results in B containing "++abc"

Comments:

See Also:
lsLeftPad lsPad lsPadCh
______________________________

lsLENGTH

Declaration:
function lsLength(A : LongString) : word;

Purpose:
Return the length of a LongString. A must have been
initialized.

Examples:
If A contains "Cogito, ergo sum."
then lsLength(A)
returns 17

Comments:

See Also:
______________________________













- 19 -



lsLOCASE

Declaration:
procedure lsLocase(A, B : LongString);
function lsLocaseF(A : LongString) : LongString;

Purpose:
Locase the LongString in A, returning a new LongString.

Examples:
If A contains "ABCdefGHIjkl"
then lsLocase(A, B);
results in B containing "abcdefghijkl"

Comments:

See Also:
lsUpcase
______________________________

lsLONGSTRING2STR

Declaration:
function lsLongString2Str(A : LongString) : string;

Purpose:
Convert a LongString to a Turbo string.

Examples:
If A (LongString) contains "abcdef"
then lsLongString2Str(A)
returns 'abcdef' (string)

Comments:
If lsLength(A) > 255, the returned string will be truncated
to length 255.

See Also:
lsStr2LongString
______________________________














- 20 -



lsPAD

Declarations:
procedure lsPad(A : LongString; Len : word; B : LongString);
function lsPadF(A : LongString; Len : word) : LongString;

Purpose:
Right-pad the LongString in A to length Len with blanks,
returning a new LongString.

Examples:
If A contains "abc"
then lsPad(A, 5, B);
results in B containing "abc "

but if lsInit(C, 5) = true
then lsPad(A, 8, C);
also results in C containing "abc "

Comments:

See Also:
lsPadCh lsLeftPad lsLeftPadCh
______________________________

lsPADCH

Declarations:
procedure lsPadCh(A : LongString; Ch : Char; Len : word;
B : LongString);
function lsPadChF(A : LongString; Ch : Char; Len : word)
: LongString;

Purpose:
Right-pad the LongString in A to length Len with Ch,
returning a new LongString.

Examples:
If A contains "abc"
then lsPadCh(A, '+', 5, B);
results in B containing "abc++"

but if lsInit(C, 5) = true
then lsPadCh(A, '+', 8, C);
also results in C containing "abc++"

Comments:

See Also:
lsPad lsLeftPad lsLeftPadCh
______________________________



- 21 -



lsPOS

Declarations:
function lsPos(Obj, A : LongString) : word;
function lsPosStr(Obj : string; A : LongString) : word;
function lsPosUC(Obj, A : LongString) : word;
function lsPosStrUC(Obj : string; A : LongString) : word;

Purpose:
Return the position of Obj in A, returning NotFound if not
found.

Examples:
If A contains "abcdeabcdeabcde"
and Obj contains "BCD"
then lsPos(A, Obj)
returns NotFound ( = 0 )
but lsPosUC(A, Obj)
returns 2

Comments:

See Also:
______________________________






























- 22 -



lsREADLN

Declaration:
procedure lsReadLn(var F : Text; A : LongString);

Purpose:
Read a LongString from a text file.

Examples:
lsReadLn(MyFile, A);

Comments:
If the "declared" length of A (set by lsInit) is less than
the actual length of the line in the text file, the incoming
string will be truncated to the "declared" length of A and the
file will be positioned at the beginning of the next line (the
exact analog of a normal Turbo PASCAL string ReadLn).

If I/O checking is not off (either by default or by a call
to lsIoff), lsIoResult MUST be called after each call to lsReadLn
or lsWriteLn. If I/O checking is on, and if an I/O error occurs,
the program will terminate with a run-time error. This action
duplicates the action of the IoResult function for normal I/O.

See Also:
lsIoff lsIon lsIoResult lsWriteLn
______________________________



























- 23 -



lsREPALL

Declarations:
procedure lsRepAll(A, Obj, Obj1, B : LongString);
function lsRepAllF(A, Obj, Obj1 : LongString): LongString;
procedure lsRepAllStr(A : LongString; Obj, Obj1 : string;
B : LongString);
function lsRepAllStrF(A : LongString; Obj, Obj1 : string)
: LongString;
procedure lsRepAllStrUC(A : LongString; Obj, Obj1 : string;
B : LongString);
function lsRepAllStrUCF(A : LongString; Obj, Obj1 : string)
: LongString;
procedure lsRepAllUC(A, Obj, Obj1, B : LongString);
function lsRepAllUCF(A, Obj, Obj1 : LongString): LongString;

Purpose:
Replaces all occurrences of Obj in A with Obj1.

Examples:
If A contains 'aabcbcabcd'
and Obj contains 'abc'
and Obj1 contains '12345'
then lsRepAll(A, Obj, Obj1, B);
results in B containing 'a12345bc12345d'

Comments:
Should the replacement of Obj by Obj1 in A result in a new
occurrence of Obj in A, the new occurrence will not be replaced.
To do so, except under rather unusual conditions, could result in
a non-terminating condition.

See Also:
lsDelAll
______________________________



















- 24 -



lsSIZEOF

Declaration:
function lsSizeOf(A : LongString) : word;

Purpose:
Returns the total heap space required for A, including the
two control words. A must have been initialized.

Examples:
See below.

Comments:
lsSizeOf MUST be used to determine the effective size of a
LongString. Any attempt to use SizeOf(A) will return a value of
4; any attempt to use SizeOf(A^) will return a value of 5.
Neither is particularly informative!

Remember that, just as
SizeOf(StringVariable)
returns a value one greater than the declared length of
StringVariable, so
lsSizeOf(LongStringVariable)
will return a value four greater than the "declared" length of
LongStringVariable.

If A has not been initialized, the results are
unpredictable.

See Also:
lsLength
______________________________






















- 25 -



lsSTR2LONGSTRING

Declarations:
procedure lsStr2LongString(S : string; A : LongString);
function lsStr2LongStringF(S : string) : LongString;

Purpose:
Convert a Turbo string into a LongString.

Examples:
If S (string) contains "abcdef"
then lsStr2LongString(S, A);
results in A (LongString) containing "abcdef"

Comments:

See Also:
lsLongString2Str
______________________________

lsTRANSFER

Declaration:
procedure lsTransfer(A, B : LongString);

Purpose:
Transfers the contents of A into B.

Examples:
B^ := A^;
INCORRECT!! This construct will give unpredictable but guar-
anteed incorrect results.

lsTransfer(A, B);
Correct. ALWAYS use lsTransfer to move the contents of one
LongString into another.

Comments:

See Also:
______________________________













- 26 -



lsTRIM

Declarations:
procedure lsTrim(A, B : LongString);
function lsTrimF(A : LongString) : LongString;

Purpose:
Return a LongString with leading and trailing white space
removed.

Examples:
If A contains " Cogito, ergo sum. "
then lsTrim(A, B);
results in B containing "Cogito, ergo sum."

Comments:
"White space" is any sequence of characters in the range
#0..#32.

See Also:
lsTrimLead lsTrimTrail
______________________________

lsTRIMLEAD

Declarations:
procedure lsTrimLead(A, B : LongString);
function lsTrimLeadF(A : LongString): LongString;

Purpose:
Return a LongString with leading white space removed.

Examples:
If A contains " Cogito, ergo sum. "
then lsTrimLead(A, B);
results in B containing "Cogito, ergo sum. "

Comments:
"White space" is any sequence of characters in the range
#0..#32.

See Also:
lsTrim lsTrimTrail
______________________________










- 27 -



lsTRIMTRAIL

Declarations:
procedure lsTrimTrail(A, B : LongString);
function lsTrimTrailF(A : LongString) : LongString;

Purpose:
Return a LongString with trailing white space removed.

Examples:
If A contains " Cogito, ergo sum. "
then lsTrimTrail(A, B);
results in B containing " Cogito, ergo sum."

Comments:
"White space" is any sequence of characters in the range
#0..#32.

See Also:
lsTrim lsTrimLead
______________________________

lsUPCASE

Declaration:
procedure lsUpcase(A, B : LongString);
function lsUpcaseF(A : LongString) : LongString;

Purpose:
Upcase the LongString in A, returning a new LongString.

Examples:
If A contains "ABCdefGHIjkl"
then lsUpcase(A, B);
results in B containing "ABCDEFGHIJKL"

Comments:

See Also:
lsLocase
______________________________













- 28 -



lsWRITELN

Declaration:
procedure lsWriteLn(var F : Text; A : LongString);

Purpose:
Write a LongString to a text file.

Examples:
lsWriteLn(MyFile, A);

Comments:
If I/O checking is not off (either by default or by a call
to lsIoff), lsIoResult MUST be called after each call to lsReadLn
or lsWriteLn. If I/O checking is on, and if an I/O error occurs,
the program will terminate with a run-time error. This action
duplicates the action of the IoResult function for normal I/O.

See Also:
lsIoff lsIon lsIoResult lsReadLn
______________________________

































- 29 -



 December 24, 2017  Add comments

Leave a Reply