Delphi String Library Documentation ----------------------------------- Info ---- file: stringlib.pas version: 1.4 author: Daniel W. Grace BSc. MMangtSc. e-mail: dan@landemann.freeserve.co.uk website: http://psand.net/projects/fe/ Blurb ----- You are welcome to use this string library provided you quote the 5 lines above. My string library is intended to be easy to use. Most of the functions are standard and intuitive. The demo program should be fairly self explanatory, however there is some nice exception handling that may not be what you would expect - I tried my best to make the functions return something sensible when you pass shite parameters - all is explained below. E-mail me if you have any problems - please let me know if you are a private individual or work for a company and also if you are interested in collaborations. Remember - if you want to be good at something start young! I started programming on a crumy ZX81 when I was 11 - I am still learning. DWG June 1999. Function Descriptions --------------------- function LeftStr(s : string; k : integer): string; - Returns k number of characters in the left part of the string s. function RightStr(s : string; k : integer): string; - Returns k number of characters in the right part of the string s. function MidStr(s : string; p, k : integer): string; - Returns k number of characters starting with the p th character. } function LeftPosStr(s, s1 : string; n : integer): integer; - Returns the position of the nth occurence of string s1 in string s counting from the left. function RightPosStr(s, s1 : string; n : integer): integer; - Returns the position of the nth occurence of string s1 in string s counting from the left. function StripAllStr(s, s1 : string): string; - Strips all occurences of string s1 from s. function StripStr(s, s1 : string; n : integer): string; - Strips the nth occurence of s1 from s. function TrimLeftStr(s, s1 : string; n : integer): string; - Trims at most n occurences (if n is zero then all occurences) of s1 from the immediate left of s. function TrimRightStr(s, s1 : string; n : integer): string; - Trims at most n occurences (if n is zero then all occurences) of s1 from the immediate right of s. function PadLeftStr(s, s1 : string; k : integer): string; - Pads the string s on the left with the string s1, returning the result to the specified length counting from the left (or as near as possible - e.g. it does not use substrings of s1 to reach the specified length. For example PadLeftStr('345', '12', 6) = '12345', not '112345'. } function PadRightStr(s, s1 : string; k : integer): string; - Pads the string s on the right with the string s1, returning the result to the specified length counting from the right(or as near as possible - e.g. it does not use substrings of s1 to reach the specified length.) function PadMidStr(s, s1 : string; p, k : integer): string; - Pads the string s in the middle at the position p with the string s1, returning the result to the specified length counting from the left. (or as near as possible - e.g. it does not use substrings of s1 to reach the specified length.) function InsertLeftStr(s, s1 : string; n : integer): string; - Inserts n copies of the string s1 to the left of s. function InsertRightStr(s, s1 : string; n : integer): string; - Inserts the n copies of the string s1 to the right of s. function InsertMidStr(s, s1 : string; p, n : integer): string; - Inserts n copies of the string s1 at position p in s. function ReplaceAllStr(s, s1, s2 : string): string; - Replaces all occurences of s1 in s with s2. function ReplaceStr(s, s1, s2 : string; n : integer): string; - Replaces the nth occurence of s1 in s with s2. function ConvToUpperStr(s : string; p, k : integer): string; - Converts lower case letters to upper case. function ConvToLowerStr(s : string; p, k : integer): string; - Converts upper case letters to lower case. function CountStr(s, s1 : string): integer; - Counts the number of occurences of string s1 in string s, starting at position p and continuing for the specified length. function IIfStr(b : boolean; s, s1: string): string; - Returns s if b is true s1 otherwise. function ValidChrStr(s, s1 : string): boolean; - Returns true if all the characters of string s are in s1, false otherwise. function ValidIntStr(s : string; a, b : integer; var i : integer): boolean; - Validates an integer. function ValidStrLen(s : string; a, b : integer): boolean; - Returns true if the string is between a and b in length. function TokenStr(s, s1 : string; n : integer): string; - Gets the nth token (string) in s whose tokens are separated by the delimeter string in s1. end.