[comp.lang.pascal] Tpas string functions library available

MATHRICH@umcvmb.missouri.edu (Rich Winkel UMC Math Department) (09/28/89)

I uploaded TPSTRING.ARC to directory PD:<MSDOS.TURBOPAS> on
SIMTEL20.ARPA.  This is version 1.2 of my STRINGS.TPU for Turbo Pascal.
This tpu contains 29 string-oriented functions paralleling the string
functions available in IBM's mainframe language Rexx.  All functions are
implemented in assembler and make extensive use of the 80x86's string
opcodes (REPxx SCASB, CMPSB, MOVSB, STOSB).  The routines are highly
optimized, FAST (check out the included benchmark program) and compact.
Included are:

LASTPOS(findstr,instr,start), FIRSTPOS(findstr,instr,start)
   Last and first position of FINDSTR in INSTR, subject to START.
   Firstpos is equivalent to TP's POS function (except for the start
   option) but runs up to 10 times faster! (Using TP 5.0)
INSTR(new,str,pos,pad) similar to TP's INSERT procedure, but 60% faster.
DELSTR(str,pos,len) similar to TP's DELETE procedure, but 50% faster.
SUBSTR(str,start,len) identical to TP's COPY function.
LEFT(str,width,pad), RIGHT(str,width,pad), CENTER(str,width,pad)
   Positions/truncates STR in a field of width WIDTH, padding out with PAD
   if needed.
WORDS(str) Number of words in STR.
SUBWORD(str,n,count), WERD(str,n)
   Extract COUNT (or 1) words from STR, starting at word N.
DELWORD(str,n,count)
   Delete COUNT words from STR, starting at word N.
WORD2POS(str,wrd), POS2WORD(str,pos)
   Convert between word number and character position.
JUSTIFY(str,len)
   Distribute blanks between words in STR to left and right justify.
SPACE(str,spc) Adjust number of spaces between each word in STR.
OVERLAY(new,str,pos,pad) Overlays NEW onto STR starting at position POS.
STRIP(str,opt,ch) Strips all leading and/or trailing CH characters from STR.
COPIES(str,count) Returns STR concatenated with itself COUNT times.
XRANGE(c1,c2) Returns string consisting of all characters from C1 to C2
   inclusive.
TRANSLATE(str,intable,outable)
   Translates characters in STR via F(intable[i]) = outable[i].
D2X(d) X2D(x) Converts between hex string and WORD type.
COMPARE(str1,str2) Character position where STR1 differs from STR2.
UPPERCASE(str), LOWERCASE(str) Case conversion.
ABBREV(str,abbr,len) Boolean: checks if ABBR is valid abbreviation for STR.
REVERSE(str) Returns contents of STR in reverse order.
VERIFY(str,reference,opt,start) Check for valid or invalid chars in STR.

TPU's for Tpas 4.0, 5.0 and 5.5 are included.
Those without access to SIMTEL20 or a TRICKLE server can get the package
from me directly.  Please specify ARC or UUEncoded ARC when ordering.

Rich Winkel
MATHRICH@UMCVMB.MISSOURI.EDU or
MATHRICH%UMCVMB@CUNYVM.CUNY.EDU or
MATHRICH@UMCVMB.BITNET