w8sdz@WSMR-SIMTEL20.ARMY.MIL (Keith Petersen) (12/20/89)
[--forwarded message--] From: Rich Winkel UMC Math Department <MATHRICH@UMCVMB.MISSOURI.EDU> I have uploaded to SIMTEL20 version 1.21 of my string functions package for Turbo Pascal. PD1:<MSDOS.TURBOPAS>TPSTR121.ARC 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. OVRSTR(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. SCANMEM(fstr,pointer,count) scans memory for a specified string. For this release I tweaked nearly all the routines, mostly using very helpful suggestions by David Kirschbaum (kirsch@arsocomvax.socom.mil). Also added the SCANMEM routine and renamed OVERLAY to OVRSTR to avoid conflict with TP's OVERLAY unit. Rich Winkel MATHRICH@UMCVMB.MISSOURI.EDU or MATHRICH%UMCVMB@CUNYVM.CUNY.EDU or MATHRICH@UMCVMB.BITNET [--end forwarded message--] Thanks, Rich! --Keith