                             String Utilities 1.0
                            (c) 1995 Randy Angove
                           These Units are Freeware


String Utilities is a set of string functions to be used with Borland Pascal
DOS/Windows/Real Mode/Protected Mode and Delphi 1.0. I have added calls for
both Pascal strings and Pchar strings. Not the best docs in the world but
they should get you by.

If you should find any bugs or would like see more added please let me know.
I can be contacted by E-mail.

Internet   - rangove@computek.net
Compuserve - 102470,1352
AOL        - rangove@aol.com

Declaration
function After(SubStr, S : String) : String;
Purpose
Return a portion  of a string after your Search String.
Example
S := 'DOS 6.22';
TmpStr := After('DOS', S);
would return "6.22"
_______________________________________________________________________
Declaration 
function PAfter(SerachStr, S : Pchar) : Pchar;
Purpose
Return a portion  of a Pchar after your Search String.
Example
S := 'DOS 6.22';
TmpStr := PAfter('DOS', S);
would return "6.22"
_______________________________________________________________________
Declaration 
function Before(SubStr: String) : String;
Purpose
Return a portion of a string before your Search String.
Example
S := 'DOS 6.22';
TmpStr := Before('6.22', S);
would return "DOS"
______________________________________________________________________
Declaration
function PBefore(SubStr, S : Pchar) : Pchar;
Purpose
Return a portion of a Pchar before your Search String.
Example
S := 'DOS 6.22';
TmpStr := PBefore('6.22', S);
would return "DOS"
______________________________________________________________________
Declaration
function Between(SubStr1, SubStr2, s : String) : String;
Purpose
Return a portion of a string before and after your Search String.
Example
S := 'DOS 6.22';
TmpStr := Between('O','.22' S);
would return "S 6"
______________________________________________________________________
Declaration
function PBetween(SubStr1, SubStr2, s : Pchar) : Pchar;
Purpose
Return a portion of a Pchar before and after your Search String.
Example
S := 'DOS 6.22';
TmpStr := PBetween('O','.22' S);
would return "S 6"
______________________________________________________________________
Declaration
function Int2Str(I : LongInt) : String;
Purpose
Convert an Integer to a String.
Example
I : Integer;
S : String;
I := 12;
S := Int2Str(I);
The string S would now be "12"
_______________________________________________________________________
Declaration
function Int2Pchar(I : LongInt) : Pchar;
Purpose
Convert an Integer to a Pchar.
Example
I : Integer;
S : Pchar;
I := 12;
S := Int2Pchar(I);
The Pchar S would now be "12"
_______________________________________________________________________
Declaration
function Real2Str(R : Real;Width, Dec : Byte) : String;
Purpose
Convert an Real to a String.
Example
R : Real;
S : String;
I := 12.99;
S := Real2Str(R, 6, 2);
The string S would now be "12.99"
_______________________________________________________________________
Declaration
function Real2Pchar(R : Real;Width, Dec : Byte) : Pchar;
Purpose
Convert an Real to a Pchar.
Example
R : Real;
S : Pchar;
I := 12.99;
S := Real2Pchar(R, 6, 2);
The Pchar S would now be "12.99"
_______________________________________________________________________
Declaration
function Str2Int(S : String) : Integer;
Purpose
Convert a string to an Integer.
Example
S : String;
I : Integer;
S := 1234;
I := Str2Int(S);
the Integer I would now be "1234"
_______________________________________________________________________
Declaration
function Pchar2Int(S : Pchar) : Integer;
Purpose
Convert a Pchar to an Integer.
Example
S : Pchar;
I : Integer;
S := 1234;
I := Pchar2Int(S);
the Integer I would now be "1234"
_______________________________________________________________________
Declaration
function Str2Long(S : String) : LongInt;
Purpose
Convert a String to an LongInt.
Example
S : String;
I : LongInt;
S := 1234;
I := Str2Long(S);
the LongInt I would now be "1234"
_______________________________________________________________________
Declaration
function Pchar2Long(S : Pchar) : LongInt;
Purpose
Convert a Pchar to an LongInt.
Example
S : Pchar;
I : LongInt;
S := 1234;
I := Pchar2Long(S);
The LongInt I would now be "1234"
_______________________________________________________________________
Declaration
function Str2Real(S : String) : Real;
Purpose
Convert a string to a Real.
Example
S : String;
R : Real;
S := 1499;
R := Str2Real(S);
R would be "14.99"
_______________________________________________________________________
Declaration
function Pchar2Real(S : Pchar) : Real;
Purpose
Convert a Pchar to a Real.
Example
S : Pchar;
R : Real;
S := 1499;
R := Pchar2Real(S);
R would be "14.99"
_______________________________________________________________________
Declaration
function Ltrim(S : String) : String;
Purpose
Remove all spaces from the left of a string.
Example
S := '     This is a Test'
Ltrim(S);
S would now be "This is a Test"
_______________________________________________________________________
Declaration
function PLtrim(S : Pchar) : Pchar;
Same as Ltrim but used with Pchar.
_______________________________________________________________________
Declaration
function Rtrim(S : String) : String;
Purpose
Remove all spaces to the right of a string.
Example
S := 'This is a Test     '
Rtrim(S);
S would now be "This is a Test"
_______________________________________________________________________
Declaration
function PRtrim(S : Pchar) : Pchar;
Same as Rtrim but used with Pchar.
_______________________________________________________________________
Declaration
function BTrim(S : String) : String;
Purpose
Remove spaces form the left and right of a string.
Example
See Ltrim and Rtrim.
_______________________________________________________________________
Declaration
function PBTrim(S : Pchar) : Pchar;
Same a Btrim but used with Pchar.
_______________________________________________________________________
Declaration
function Lpad(S : String; Count : Byte) : String;
Purpose
Add spaces to the left of a string.
Example
TmpStr := Lpad('This is a test', 5);
TmpStr would look like this "     This is a test"
_______________________________________________________________________
Declaration
function PLpad(S : Pchar; Count : Byte) : Pchar;
Same as LPad but used with Pchar.
_______________________________________________________________________
Declaration
function Rpad(S : String; Count : Byte) : String;
Purpose
Same as Lpad but will add spaces to the right of a string.
_______________________________________________________________________
Declaration
function PRpad(S : Pchar; Count : Byte) : Pchar;
Same as Rpad but used with Pchar.
_______________________________________________________________________
Declaration
function UpperCase(S : String) : String;
Purpose
Convert a string to Upper Case.
_______________________________________________________________________
Declaration
function PUpperCase(S : Pchar) : Pchar;
Same as using UpperCase but using Pchar.
_______________________________________________________________________
Declaration
function LowerCase(S : String) : String;
Purpose
Convert a string to Lower Case.
_______________________________________________________________________
Declaration
function PLowerCase(S : Pchar) : Pchar;
Same as LowerCase but used with Pchar.
_______________________________________________________________________
Declaration
function Proper(S : String) : String;
Purpose
Return a string as proper case.
Example
S := 'mr. john smith';
S := Proper(S);
After calling proper S would return "Mr. John Smith"
_______________________________________________________________________
Declaration
function PProper(S : Pchar) : Pchar;
Same as Proper but used with Pchar.
_______________________________________________________________________
Declaration
function Plural(Count : LongInt; RootWord : String) : String;
Purpose
Returns the singular or plural of a noun.
Example
Tmpstr := Plural(0, 'Page')
TmpStr would be "NO Pages"
Tmpstr := Plural(3, 'Page')
TmpStr would be "3 Pages"
_______________________________________________________________________
Declaration
function PPlural(I : LongInt; S : Pchar) : Pchar;
Same as Plural but used with Pchar.
