home *** CD-ROM | disk | FTP | other *** search
- {$B-,D-,F-,I+,N-,R-,S+,V+}
-
- (*
- Timo Salmi UNiT D
- A Turbo Pascal 5.0 unit for string manipulation and so on.
- All rights reserved 2-Aug-89,
- Updated 3-Aug-89, 19-Aug-89, 26-Sep-89, 13-Jun-90
-
- This unit contains mainly string manipulation routines. There is not anything
- novel about them. Just that I have tried to make them compact and fast.
- No inline code, though, is involved in this (nor the other) units.
-
- This unit may be used and distributed freely for PRIVATE, NON-COMMERCIAL,
- NON-INSTITUTIONAL purposes, provided it is not changed in any way. For
- ANY other usage, contact the author.
-
- The units are under development. Comments and contacts are solicited. If
- you have any questions, please do not hesitate to use electronic mail for
- communication.
- InterNet address: ts@chyde.uwasa.fi (preferred)
- Funet address: GADO::SALMI
- Bitnet address: SALMI@FINFUN
- FidoNet address: 2:515/1 (Micro Maniacs Opus, To: Timo Salmi)
-
- The author shall not be liable to the user for any direct, indirect or
- consequential loss arising from the use of, or inability to use, any unit,
- program or file howsoever caused. No warranty is given that the units and
- programs will work under all circumstances.
-
- Timo Salmi
- Professor of Accounting and Business Finance
- School of Business Studies, University of Vaasa
- P.O. BOX 297, SF-65101 Vaasa, Finland
- *)
-
- unit TSUNTD;
-
- (* ======================================================================= *)
- interface
- (* ======================================================================= *)
-
- uses Dos;
-
- (* Trim a string right *)
- function TRIMRGFN (original : string; atcolumn : byte) : string;
-
- (* Trim a string left *)
- function TRIMLFFN (original : string; atcolumn : byte) : string;
-
- (* Lead a string with a suitable number of chosen characters *)
- function LEADFN (original : string;
- total_length : byte;
- leadwith : char) : string;
-
- (* Trail a string with a suitable number of chosen characters *)
- function TRAILFN (original : string;
- total_length : byte;
- trailwith : char) : string;
-
- (*
- Turbo Pascal's own units may occasionally cause problems when run on
- poorly compatible computers. In particular, the Ctr unit is problematic
- in this respect. The dosdelay procedure is a replacement of Turbo Pascal's
- own Delay procedure which is in the Crt unit. The accuracy of dosdelay
- is not as good as Delay's.
- *)
- procedure DOSDELAY (milliseconds : word);
-
- (*
- AUDIO is a replacement and enhancement of Turbo Pascal's sound procedure.
- AUDIO does not need the Crt unit, and it takes the duration of the sound
- as a parameter in milliseconds. This procedure first appears in release
- tspas19 of this collection. AUDIO has been written in collaboration with
- Ari Hovila.
- *)
- procedure AUDIO (frequency : longint; duration : word);
-
- (* =======================================================================
- String parsing routines
- ======================================================================= *)
- const parse_parts_max = 255;
- type parseVectorType = array [1..parse_parts_max] of string;
- parseVectorPtrType = ^parseVectorType;
-
- (* Extract all substrings from a string *)
- procedure PARSE
- (original : string;
- parse_parts_max : integer;
- separators : string;
- var nber_of_parts : integer;
- var partPtr : parseVectorPtrType;
- var ok : boolean); {no errors detected}
-
- (* This, and the following function, are alternatives to the PARSE procedure.
- STRCNTFN and SPARTFN resemble more closely the inbuilt ParamCount and
- ParamStr function. They do not require using pointers as PARSE does.
- These two functions first appear in release tspas14.arc.
- The purpose of STRCNTFN is to return the number of substrings in a string
- *)
- function STRCNTFN (s : string; separators : string) : integer;
-
- (* Returns the specified substring in a string *)
- function SPARTFN (s : string;
- separators : string;
- PartNumber : integer) : string;
-
-
-