home *** CD-ROM | disk | FTP | other *** search
/ Share Gallery 1 / share_gal_1.zip / share_gal_1 / LA / LA018.ZIP / STRG55.ARC / STRGREF.DOC < prev   
Text File  |  1990-01-02  |  87KB  |  1,872 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.                                  STRG UTILITIES
  21.                                  REFERENCE GUIDE
  22.  
  23.                                    Version 5.5
  24.                                  January 2, 1990
  25.  
  26.  
  27.                Copyright (C) 1989-1990 Eagle Performance Software
  28.                               All Rights Reserved.
  29.  
  30.  
  31.  
  32.                                _______                     
  33.                           ____|__     |               (tm) 
  34.                        --|       |    |------------------- 
  35.                          |   ____|__  |  Association of    
  36.                          |  |       |_|  Shareware         
  37.                          |__|   o   |    Professionals     
  38.                        -----|   |   |--------------------- 
  39.                             |___|___|    MEMBER            
  40.  
  41.  
  42.    STRG Utilities                                Reference Guide, Version 5.5
  43.  
  44.  
  45.  
  46.                        T A B L E   O F   C O N T E N T S
  47.  
  48.         1. INTRODUCTION  . . . . . . . . . . . . . . . . . . . . . 4
  49.              Purpose . . . . . . . . . . . . . . . . . . . . . . . 4
  50.              Parameters  . . . . . . . . . . . . . . . . . . . . . 4
  51.              Code Size . . . . . . . . . . . . . . . . . . . . . . 5
  52.              Speed . . . . . . . . . . . . . . . . . . . . . . . . 5
  53.  
  54.         2. PROCEDURES AND FUNCTIONS  . . . . . . . . . . . . . . . 6
  55.              AscStr  . . . . . . . . . . . . . . . . . . . . . . . 6
  56.              ChrDel* . . . . . . . . . . . . . . . . . . . . . . . 6
  57.              ChrFill . . . . . . . . . . . . . . . . . . . . . . . 7
  58.              ChrPad* . . . . . . . . . . . . . . . . . . . . . . . 7
  59.              ChrPos* . . . . . . . . . . . . . . . . . . . . . . . 7
  60.              ChrQty* . . . . . . . . . . . . . . . . . . . . . . . 8
  61.              ChrRepl*  . . . . . . . . . . . . . . . . . . . . . . 8
  62.              Copy  . . . . . . . . . . . . . . . . . . . . . . . . 9
  63.              Delete  . . . . . . . . . . . . . . . . . . . . . . . 9
  64.              Is* . . . . . . . . . . . . . . . . . . . . . . . . . 9
  65.              LnStr . . . . . . . . . . . . . . . . . . . . . . . . 10
  66.              StrAsc  . . . . . . . . . . . . . . . . . . . . . . . 11
  67.              StrLn . . . . . . . . . . . . . . . . . . . . . . . . 11
  68.              Str*  . . . . . . . . . . . . . . . . . . . . . . . . 12
  69.              StrBin  . . . . . . . . . . . . . . . . . . . . . . . 12
  70.              StrBrk  . . . . . . . . . . . . . . . . . . . . . . . 12
  71.              StrCat* . . . . . . . . . . . . . . . . . . . . . . . 13
  72.              StrCmp* . . . . . . . . . . . . . . . . . . . . . . . 13
  73.              StrCopy . . . . . . . . . . . . . . . . . . . . . . . 14
  74.              StrCut  . . . . . . . . . . . . . . . . . . . . . . . 14
  75.              StrDeTab  . . . . . . . . . . . . . . . . . . . . . . 14
  76.              StrEnum . . . . . . . . . . . . . . . . . . . . . . . 15
  77.              StrFill . . . . . . . . . . . . . . . . . . . . . . . 15
  78.              StrHex  . . . . . . . . . . . . . . . . . . . . . . . 15
  79.              StrIns  . . . . . . . . . . . . . . . . . . . . . . . 16
  80.              StrJ* . . . . . . . . . . . . . . . . . . . . . . . . 16
  81.              StrLwr  . . . . . . . . . . . . . . . . . . . . . . . 16
  82.              StrMemb . . . . . . . . . . . . . . . . . . . . . . . 17
  83.              StrMove . . . . . . . . . . . . . . . . . . . . . . . 17
  84.              StrOvr  . . . . . . . . . . . . . . . . . . . . . . . 17
  85.              StrPeek . . . . . . . . . . . . . . . . . . . . . . . 18
  86.              StrPoke . . . . . . . . . . . . . . . . . . . . . . . 18
  87.              StrPos* . . . . . . . . . . . . . . . . . . . . . . . 18
  88.              StrQty* . . . . . . . . . . . . . . . . . . . . . . . 19
  89.              StrRepl*  . . . . . . . . . . . . . . . . . . . . . . 19
  90.              StrReTab  . . . . . . . . . . . . . . . . . . . . . . 20
  91.              StrRev  . . . . . . . . . . . . . . . . . . . . . . . 20
  92.              StrRoll . . . . . . . . . . . . . . . . . . . . . . . 20
  93.              StrSort . . . . . . . . . . . . . . . . . . . . . . . 21
  94.              StrSpn  . . . . . . . . . . . . . . . . . . . . . . . 21
  95.              StrUpr  . . . . . . . . . . . . . . . . . . . . . . . 22
  96.              ValBin  . . . . . . . . . . . . . . . . . . . . . . . 22
  97.              ValHex  . . . . . . . . . . . . . . . . . . . . . . . 22
  98.              Wrd*  . . . . . . . . . . . . . . . . . . . . . . . . 23
  99.              WrdParse  . . . . . . . . . . . . . . . . . . . . . . 23
  100.  
  101.  
  102.                                        2
  103.    STRG Utilities                                Reference Guide, Version 5.5
  104.  
  105.  
  106.              WrdPos* . . . . . . . . . . . . . . . . . . . . . . . 24
  107.              WrdQty  . . . . . . . . . . . . . . . . . . . . . . . 25
  108.              WrdToken  . . . . . . . . . . . . . . . . . . . . . . 25
  109.  
  110.         3. VARIABLES . . . . . . . . . . . . . . . . . . . . . . . 27
  111.              Global  . . . . . . . . . . . . . . . . . . . . . . . 27
  112.              Local . . . . . . . . . . . . . . . . . . . . . . . . 28
  113.  
  114.         4. QUICK REFERENCE . . . . . . . . . . . . . . . . . . . . 29
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.  
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.                                        3
  164.    STRG Utilities                                Reference Guide, Version 5.5
  165.  
  166.  
  167.    1.  I N T R O D U C T I O N
  168.  
  169.  
  170.    PURPOSE
  171.  
  172.    This document is a STRG technical reference manual describing each routine 
  173.    and variable in detail in a format similar to the Borland manual.  The 
  174.    routines are described in alphabetical order.  Since this manual is on 
  175.    disk, you can find your interest easily with a search utility.
  176.  
  177.    Application - All STRG procedures process strings with high-speed optimized 
  178.    assembly code.  To be as fast as possible, almost all routines are 
  179.    procedures rather than functions to increase speed 2 to 3 times.
  180.  
  181.  
  182.    PARAMETERS
  183.  
  184.    Common Parameters - Most procedures use the same parameters.  Rather than 
  185.    repeating them for each routine, detailed descriptions for those parameters 
  186.    are listed below.
  187.  
  188.      Count    - number of characters or substrings to copy.
  189.      Decimals - number of digits to the right of the decimal.
  190.      Dest     - Pascal destination string (as opposed to source).
  191.      Field    - number of digits in the field.
  192.      Find     - a character or substring to find in a source string.
  193.      Index    - the starting offset in the Pascal source string.
  194.      MaxLen   - the maximum length permitted for the resulting string to 
  195.                 prevent overwriting memory.
  196.      Nth      - process until the "Nth" occurrence.
  197.      Repl     - replacement character or substring.
  198.      S        - Pascal source string.
  199.      Source   - Pascal source string (as opposed to destination).
  200.  
  201.    Order of Parameters - Of course not all of these parameters may be used, 
  202.    but the order of the parameters is consistent throughout the routines.  
  203.    Here is the general order:
  204.  
  205.      1. Destination - such as Dest
  206.      2. Source      - such as S and Source
  207.      3. Substrings  - such as Find, Repl, Fill, First, and Last
  208.      4. Index       - always of the source
  209.      5. Count       - such as Count, Field, Nth and Qty
  210.      6. Maximum     - maximum length of destination string 
  211.  
  212.    This arrangement matches that of C.  For procedures, if there is a 
  213.    destination, it is always the first parameter; just like the assignment, 
  214.    (":=") the destination is always on the left.
  215.  
  216.    Index - All index parameters are 1-based.  If a zero is entered, it is 
  217.    converted to 1.  The Delete procedure is the only exception to this, but it 
  218.    is part of standard Pascal.
  219.  
  220.  
  221.  
  222.  
  223.  
  224.    Chapter 1, Introduction                                             Page 4
  225.    STRG Utilities                                Reference Guide, Version 5.5
  226.  
  227.  
  228.    CODE SIZE
  229.  
  230.    Unit Size - If you use a STRG procedure, only the corresponding object file 
  231.    containing that procedure will be linked and thereby optimizing the code.  
  232.    Even if all 108 procedures are used, STRG is still quite small at a total 
  233.    of about 6.3k bytes.  In all, there are 77 object files used to create the 
  234.    unit which is about 5800 lines of assembly.
  235.  
  236.    Code Usage - This Shareware unit has been released with the $N+ and $E+ 
  237.    compiler directives set.  This means that an additional 12k of code is 
  238.    included for the IEEE reals library inserted by the compiler.  The IEEE 
  239.    reals are used in the Str* numeric formatting functions and are enabled for 
  240.    your testing.  Should you not want to use these functions and are a 
  241.    registered user, you can turn off these directives at the beginning of the 
  242.    STRG unit.  This will drop the IEEE library from the executable code.
  243.  
  244.  
  245.    SPEED
  246.  
  247.    Speed Bench - How fast is fast?  To have a basis for comparison, a unit of 
  248.    strings-per-second (str/sec) is used for a relative measure of speed.  To 
  249.    get this rating, a routine is repeated with a FOR loop to operate on a 
  250.    given string and any "reset" of the original string is subtracted out as 
  251.    overhead.  The RATE55.PAS program can duplicate this for you so you can 
  252.    bench test your own routines for actual speed.  Overall, if you use STRG 
  253.    for your application, your speeds will easily be 3 times faster or more.
  254.  
  255.    Relative Speed - The ratings mentioned in the Reference Manual are speeds 
  256.    obtained from actual bench test on an 80386 / 20 MHz machine.  Granted, 
  257.    that this may be faster than most units, but the important aspect of these 
  258.    ratings is relative speed.  By comparing ratings with other routines in 
  259.    this unit, you can judge how to best assemble a program technique that can 
  260.    suit your needs.
  261.  
  262.    Processing Rating - Not only can machines vary in speed, but the string 
  263.    values in your program are complete variables.  When given a routine like 
  264.    StrPosL, the test performed is on an 80-character string with a 5-letter 
  265.    word at the end of the string.  So the test forces the routine to search 
  266.    the entire string.  This provides a worst case scenario to give you a feel 
  267.    for the length of time for an operation.  Similarly, StrPosR is tested with 
  268.    the 5-letter word at the beginning of the string and so the ratings for 
  269.    both routines are about the same.  But one of these routines may be much 
  270.    better for your program from a strategic standpoint.  So, the rating 
  271.    provided gives one of processing performance and not from the perspective 
  272.    that a better rating means faster speed for your application.
  273.  
  274.  
  275.  
  276.  
  277.  
  278.  
  279.  
  280.  
  281.  
  282.  
  283.  
  284.  
  285.    Chapter 1, Introduction                                             Page 5
  286.    STRG Utilities                                Reference Guide, Version 5.5
  287.  
  288.  
  289.    2.  P R O C E D U R E S   A N D   F U N C T I O N S
  290.  
  291.    In this section, a detailed description is provided for each procedure and 
  292.    function.
  293.  
  294.  
  295.    ---------------------------------------------------------------------------
  296.    AscStr procedure                                                       Strg
  297.    ---------------------------------------------------------------------------
  298.    Function       Creates ASCIIZ strings from Pascal-type strings.
  299.    Declaration    AscStr (VAR AscDest; S: string)
  300.    Remarks        After AscStr is executed, the global variable AscDestPtr is 
  301.                   updated to point to the next destination address just after 
  302.                   the null.  Source and destination can be the same.  As in 
  303.                   all move-type procedures, it is important to make sure the 
  304.                   destination size is sufficient to fit the source.
  305.    Rating         42,900 str/sec
  306.    See also       LnStr, StrAsc and the variable AscDestPtr.
  307.    Example        Pack three Pascal strings into an array of ASCIIZ strings.
  308.  
  309.                     uses strg;
  310.                     var
  311.                       S: array[0..4] of string;
  312.                       A: array[0..26] of char;
  313.                       i: byte;
  314.                     begin
  315.                       S[1] := 'Eagle';
  316.                       S[2] := 'Performance';
  317.                       S[3] := 'Software';
  318.                       AscDestPtr := @A;
  319.                       for i:=1 to 3 do
  320.                         AscStr (AscDestPtr^,S[i]);
  321.                       end.
  322.  
  323.                   The resulting array A would look like:
  324.  
  325.                     'Eagle'#00'Performance'#00'Software'#00
  326.  
  327.    ---------------------------------------------------------------------------
  328.    ChrDel* procedure                                                      Strg
  329.    ---------------------------------------------------------------------------
  330.    Function       Operates on a string to delete a given character.
  331.    Declaration    ChrDel  (VAR S: string; Find: char)
  332.                   ChrDelL (VAR S: string; Find: char)
  333.                   ChrDelR (VAR S: string; Find: char)
  334.    Remarks        ChrDel deletes all finds in the entire string.
  335.                   ChrDelL deletes only left (or leading) finds.
  336.                   ChrDelR deletes only right (or trailing) finds.
  337.    Rating         ChrDel:    9,400 str/sec
  338.                   ChrDelL:  39,000 str/sec
  339.                   ChrDelR: 132,000 str/sec
  340.    See also       StrCut
  341.    Example        Try these examples:
  342.  
  343.  
  344.  
  345.  
  346.    Chapter 2, Procedures and Functions                                 Page 6
  347.    STRG Utilities                                Reference Guide, Version 5.5
  348.  
  349.  
  350.                     MyString := '   more info ';
  351.                     MyNumStr := '1,234,567';
  352.                     ChrDel  (MyNumStr,',');    { MyNumStr='1234567'      }
  353.                     ChrDelL (MyString,' ');    { MyString='more info '   }
  354.                     ChrDelR (MyString,' ');    { MyString='   more info' }
  355.  
  356.    ---------------------------------------------------------------------------
  357.    ChrFill procedure                                                      Strg
  358.    ---------------------------------------------------------------------------
  359.    Function       Fills a string with multiple copies of a character.
  360.    Declaration    ChrFill (VAR S: string; Fill: char; Count: byte)
  361.    Remarks        The fill overwrites S with Count number of repetitions of 
  362.                   Fill and automatically sets the length byte.  Be sure the 
  363.                   destination is large enough.  Up to twice as fast as using 
  364.                   system.fillchar.
  365.    Rating         53,400 str/sec
  366.    See also       StrEnum, StrFill
  367.    Example        Try the following example:
  368.  
  369.                     ChrFill (S,'a',5);    { S='aaaaa' }
  370.  
  371.    ---------------------------------------------------------------------------
  372.    ChrPad* procedure                                                      Strg
  373.    ---------------------------------------------------------------------------
  374.    Function       Pads a string on the left, right, or to center with a given 
  375.                   character to fill a field.
  376.    Declaration    ChrPadC (VAR S: string; Fill: char; Field: byte)
  377.                   ChrPadL (VAR S: string; Fill: char; Field: byte)
  378.                   ChrPadR (VAR S: string; Fill: char; Field: byte)
  379.    Remarks        ChrPadC pads left and right to center the field.
  380.                   ChrPadL pads on the left (or leading) fill.
  381.                   ChrPadR pads on the right (or trailing) fill.
  382.    Rating         ChrPadC: 36,500 str/sec
  383.                   ChrPadL: 42,900 str/sec
  384.                   ChrPadR: 52,000 str/sec
  385.    See also       ChrDel, StrCut, StrJ*
  386.    Example        Try these examples:
  387.  
  388.                     MyStr := 'abcdefgh';       {           12345678901   }
  389.                     ChrPadC (MyStr,'*',11);    { MyString='*abcdefgh**'  }
  390.                     ChrPadL (MyStr,'=',11);    { MyString='===abcdefgh'  }
  391.                     ChrPadR (MyStr,' ',11);    { MyString='abcdefgh   '  }
  392.  
  393.    ---------------------------------------------------------------------------
  394.    ChrPos* function                                                       Strg
  395.    ---------------------------------------------------------------------------
  396.    Function       Finds the position of a given character with match/ignore 
  397.                   case.
  398.    Declaration    ChrPosL  (S: string; Find: char; Nth: byte)
  399.                   ChrPosLI (S: string; Find: char; Nth: byte)
  400.                   ChrPosR  (S: string; Find: char; Nth: byte)
  401.                   ChrPosRI (S: string; Find: char; Nth: byte)
  402.                   ChrPosX  (S: string; Find: char; indeX: byte)
  403.                   ChrPosXI (S: string; Find: char; indeX: byte)
  404.    Result type    byte
  405.  
  406.  
  407.    Chapter 2, Procedures and Functions                                 Page 7
  408.    STRG Utilities                                Reference Guide, Version 5.5
  409.  
  410.  
  411.    Remarks        Using suffixes, -L routine searches from the left while the 
  412.                   -R searches from the right for the Nth occurrence.  The -X 
  413.                   routine starts at the given index and searches right for the 
  414.                   first occurrence.  These routines match case, while those 
  415.                   with the added -I suffix will Ignore case.
  416.    Rating         ChrPos?:  25,400 str/sec
  417.                   ChrPos?I: 22,500 str/sec  (non-alphabetic Find)
  418.                   ChrPos?I: 10,200 str/sec  (alphabetic Find)
  419.    See also       StrBrk, StrPos*
  420.    Example        Try the following examples:
  421.  
  422.                     S1 := 'C:\MySubDir\SubDir#2\myfile';
  423.                     S2 := 'Eagle Performance Software';
  424.                     MyByte := ChrPosR  (S1,'\',1);   { MyByte=21 }
  425.                     MyByte := ChrPosLI (S2,'e',3);   { MyByte= 8 }
  426.                     MyByte := ChrPosXI (S2,'s',8);   { MyByte=19 }
  427.  
  428.    ---------------------------------------------------------------------------
  429.    ChrQty* function                                                       Strg
  430.    ---------------------------------------------------------------------------
  431.    Function       Counts the occurrences a given character in a string with 
  432.                   match/ignore case.
  433.    Declaration    ChrQty  (S: string; Find: char)
  434.                   ChrQtyI (S: string; Find: char)
  435.    Result type    byte
  436.    Remarks        ChrQty matches case while ChrQtyI ignores case.
  437.    Rating         ChrQty:  23,100 str/sec
  438.                   ChrQtyI: 22,500 str/sec  (non-alphabetic Find)
  439.                   ChrPosI: 10,200 str/sec  (alphabetic Find)
  440.    See also       StrQty*, WrdQty
  441.    Example        Given a string, S:='Eagle Performance Software', try the 
  442.                   following examples:
  443.  
  444.                     MyByte := ChrQty  (S,'a');   { MyByte=3 }
  445.                     MyByte := ChrQtyI (S,'e');   { MyByte=5 }
  446.  
  447.    ---------------------------------------------------------------------------
  448.    ChrRepl* procedure                                                     Strg
  449.    ---------------------------------------------------------------------------
  450.    Function       Finds and replaces a character from a given index for Qty 
  451.                   number of replacements with match/ignore case. 
  452.    Declaration    ChrRepl  (VAR S: string; Find,Repl: char; Index,Qty: byte)
  453.                   ChrReplI (VAR S: string; Find,Repl: char; Index,Qty: byte)
  454.    Remarks        The operation starts from Index and goes to the right.  It 
  455.                   will stop if the index is beyond the end of string or it has 
  456.                   replaced as many as it can.  ChrRepl matches case while 
  457.                   ChrReplI ignores case.
  458.    Rating         ChrRepl:  21,300 str/sec
  459.                   ChrReplI: 20,300 str/sec  (non-alphabetic Find)
  460.                   ChrReplI: 10,000 str/sec  (alphabetic Find)
  461.    See also       ChrDel*, StrRepl*
  462.    Example        Try the following example:
  463.  
  464.                     S := '/s -12 -cga /off';
  465.                     ChrRepl (S,'-','/',1,255);   { S='/s /12 /cga /off' }
  466.  
  467.  
  468.    Chapter 2, Procedures and Functions                                 Page 8
  469.    STRG Utilities                                Reference Guide, Version 5.5
  470.  
  471.  
  472.  
  473.    ---------------------------------------------------------------------------
  474.    Copy function                                                          Strg
  475.    ---------------------------------------------------------------------------
  476.    Function       Returns a substring of a string.
  477.    Declaration    Copy (S: string; Index,Count: integer)
  478.    Result type    string
  479.    Remarks        Exact replacement of the System.Copy function, but 
  480.                   automatically replaces it with one that is up to 25% faster.
  481.    Rating         21,500 str/sec
  482.    See also       StrCopy, StrOvr, Compiler reference manual
  483.  
  484.    ---------------------------------------------------------------------------
  485.    Delete procedure                                                       Strg
  486.    ---------------------------------------------------------------------------
  487.    Function       Deletes a substring from a string.
  488.    Declaration    Delete (VAR S: string; Index,Count: integer)
  489.    Remarks        Exact replacement of the System.Delete procedure, but 
  490.                   automatically replaces it with one that is up to 5 times 
  491.                   faster.
  492.    Rating         39,300 str/sec
  493.    See also       ChrDel*, StrCut, Compiler reference manual
  494.  
  495.    ---------------------------------------------------------------------------
  496.    Is* function                                                           Strg
  497.    ---------------------------------------------------------------------------
  498.    Function       Character classification function.
  499.    Declaration    IsAlNum  (C: char)   { Alpha-numeric }
  500.                   IsAlpha  (C: char)   { Upper and lower case letters }
  501.                   IsASCII  (C: char)   { Lower ASCII table }
  502.                   IsCntrl  (C: char)   { Print control characters }
  503.                   IsDigit  (C: char)   { 0 through 9 }
  504.                   IsDOS    (C: char)   { Valid DOS directory & wildcards }
  505.                   IsFile   (C: char)   { Valid DOS file name }
  506.                   IsGraph  (C: char)   { Black characters }
  507.                   IsLower  (C: char)   { Lower case letters }
  508.                   IsPath   (C: char)   { Valid DOS path & drive & subdirs }
  509.                   IsPrint  (C: char)   { Printable characters }
  510.                   IsPunct  (C: char)   { Punctuation marks }
  511.                   IsReal   (C: char)   { Real numbers }
  512.                   IsSigned (C: char)   { Signed integers }
  513.                   IsSpace  (C: char)   { Space or line control }
  514.                   IsUpper  (C: char)   { Upper case letters }
  515.                   IsXDigit (C: char)   { Hex digits }
  516.    Result type    boolean
  517.    Remarks        These exactly duplicate the C implementation of character 
  518.                   classification, but a few are unique to STRG.  The best 
  519.                   balance of speed and code is used for each one and they are 
  520.                   more efficient than the use of sets.  All functions only 
  521.                   consider characters in the lower ASCII table (<#128).  The 
  522.                   function will return TRUE if the following characters are 
  523.                   passed (the "-" means through):
  524.  
  525.                     IsAlNum:   0-9 A-Z a-z
  526.                     IsAlpha:   A-Z a-z
  527.  
  528.  
  529.    Chapter 2, Procedures and Functions                                 Page 9
  530.    STRG Utilities                                Reference Guide, Version 5.5
  531.  
  532.  
  533.                     IsASCII:   Less than #128
  534.                     IsCntrl:   #00-#31 #127
  535.                     IsDigit:   0-9
  536.                     IsDOS:     ! #-* #45 #46 0-: ?-Z \ ^-{ }-~
  537.                     IsFile:    ! #-) #45 #46 0-9 @-Z   ^-{ }-~
  538.                     IsGraph:   #33-#126
  539.                     IsLower:   a-z
  540.                     IsPath:    ! #-) #45 #46 0-: @-Z \ ^-{ }-~
  541.                     IsPrint:   #32-#126
  542.                     IsPunct:   IsGraph but not IsAlNum
  543.                     IsReal:    0-9 + Minus . e E
  544.                     IsSigned:  0-9 + Minus
  545.                     IsSpace:   Space #09-#13
  546.                     IsUpper:   A-Z
  547.                     IsXDigit:  0-9 A-F a-f
  548.  
  549.                   IsDos checks for characters that are valid when asking for a 
  550.                   directory at the DOS command prompt such as:
  551.  
  552.                      C:\MySubDir\Subdir#2\All?.*
  553.  
  554.                   IsPath is the same as IsDos except it doesn't accept the 
  555.                   wildcards '*' and '?'.  IsFile is the the same as IsPath 
  556.                   except it will not accept the drive and path characters ':' 
  557.                   and '\'.
  558.    See also       StrMemb
  559.    Example        Create a membership string containing only valid Real number 
  560.                   characters:
  561.  
  562.                     S := '';
  563.                     for MyChar:='+' to 'e' do
  564.                       if IsReal (MyChar) then
  565.                         StrCat (S,MyChar,255);     { S='+-.1234567890Ee' }
  566.  
  567.    ---------------------------------------------------------------------------
  568.    LnStr procedure                                                        Strg
  569.    ---------------------------------------------------------------------------
  570.    Function       Creates ASCII TEXT strings from Pascal-type strings.
  571.    Declaration    LnStr (VAR LnDest; S: string)
  572.    Remarks        LnStr copies the characters of string S to the line 
  573.                   destination Ln and terminates the line with a CR/LF 
  574.                   (#13/#10).  After StrLn is executed, the global variable 
  575.                   LnDestPtr points to the next destination after the CR/LF.  
  576.                   As in all move-type procedures, it is important to make sure 
  577.                   the destination size is sufficient to fit the source.
  578.    Suggestions    The use of WriteLn for text files is disk intensive.  LnStr 
  579.                   can be used together with BlockWrite for extremely fast text 
  580.                   file operations.
  581.    Rating         42,200 str/sec
  582.    See also       AscStr, StrLn, and variable LnDestPtr
  583.    Example        Similar to the example in StrAsc.
  584.  
  585.  
  586.  
  587.  
  588.  
  589.  
  590.    Chapter 2, Procedures and Functions                                 Page 10
  591.    STRG Utilities                                Reference Guide, Version 5.5
  592.  
  593.  
  594.    ---------------------------------------------------------------------------
  595.    StrAsc procedure                                                       Strg
  596.    ---------------------------------------------------------------------------
  597.    Function       Creates Pascal strings from ASCIIZ-type strings.
  598.    Declaration    StrAsc (VAR Dest: string; VAR AscSrc; MaxLen: byte)
  599.    Remarks        After StrAsc is executed, the global variable AscSrcPtr 
  600.                   points to the next ASCIIZ string skipping over any null 
  601.                   character.  Should the conversion be truncated with MaxLen, 
  602.                   StrAsc makes sure that AscSrcPtr points to the next string 
  603.                   and not a null.  Source and destination can be the same.  As 
  604.                   in all move-type procedures, it is important to make sure 
  605.                   the destination size is sufficient to fit the source.
  606.    Rating         17,000 str/sec
  607.    See also       StrLn, AscStr
  608.    Example        Disassemble a sequential array of ASCIIZ strings into three 
  609.                   Pascal strings:
  610.  
  611.                     uses strg;
  612.                     const
  613.                       A: array[0..26] of char = 
  614.                          'Eagle'#00'Performance'#00'Software'#00;
  615.                     var
  616.                       S: array[0..4] of string;
  617.                       i: byte;
  618.                     begin
  619.                       AscSrcPtr := @A;
  620.                       for i:=1 to 3 do
  621.                         StrAsc (S[i],AscSrcPtr^,255);
  622.                     end.
  623.  
  624.                   The resulting strings would look like:
  625.  
  626.                     S[1] := 'Eagle';
  627.                     S[2] := 'Performance';
  628.                     S[3] := 'Software';
  629.  
  630.    ---------------------------------------------------------------------------
  631.    StrLn procedure                                                        Strg
  632.    ---------------------------------------------------------------------------
  633.    Function       Creates Pascal strings from ASCII TEXT strings.
  634.    Declaration    StrLn (VAR Dest: string; VAR LnSrc; MaxLen: byte)
  635.    Remarks        ASCII text file lines by definition end with a CR (#13) or a 
  636.                   CR/LF (#13/#10).  StrLn searches for the CR and copies the 
  637.                   string prior to that character.  After StrLn is executed, 
  638.                   the global variable LnSrcPtr points to the next line 
  639.                   skipping over any CR or LF even if the string is truncated 
  640.                   with MaxLen.  Source and destination can be the same for 
  641.                   non-sequential conversions.  As in all move-type procedures, 
  642.                   it is important to make sure the destination size is 
  643.                   sufficient to fit the source.
  644.    Suggestions    The use of ReadLn for text files is disk intensive.  StrLn 
  645.                   can be used together with BlockRead for extremely fast text 
  646.                   file operations.
  647.    Rating         16,800 str/sec
  648.    See also       AscStr, LnStr, and variable LnSrcPtr
  649.  
  650.  
  651.    Chapter 2, Procedures and Functions                                 Page 11
  652.    STRG Utilities                                Reference Guide, Version 5.5
  653.  
  654.  
  655.    Example        Similar to the example in AscStr. 
  656.  
  657.    ---------------------------------------------------------------------------
  658.    Str* function                                                          Strg
  659.    ---------------------------------------------------------------------------
  660.    Function       Converts numbers to a string representation.
  661.    Declaration    StrC   (C: comp):
  662.                   StrCF  (C: comp; Field: integer)
  663.                   StrCFD (C: comp; Field,Decimals: integer)
  664.                   StrD   (D: double)
  665.                   StrDF  (D: double; Field: integer)
  666.                   StrDFD (D: double; Field,Decimals: integer)
  667.                   StrE   (E: extended)
  668.                   StrEF  (E: extended; Field: integer)
  669.                   StrEFD (E: extended; Field,Decimals: integer)
  670.                   StrL   (L: longint)
  671.                   StrLF  (L: longint; Field: integer)
  672.                   StrR   (R: real)
  673.                   StrRF  (R: real; Field: integer)
  674.                   StrRFD (R: real; Field,Decimals: integer)
  675.                   StrS   (S: single)
  676.                   StrSF  (S: single; Field: integer)
  677.                   StrSFD (S: single; Field,Decimals: integer)
  678.    Result type    string
  679.    Remarks        These functions use the System.Str procedure, but have been 
  680.                   converted to a function form for convenience.  Although they 
  681.                   are a fraction slower, they save code in the long run.  The 
  682.                   IEEE reals are included only if the N/E compiler directives 
  683.                   are appropriately set for your use.
  684.    Rating         Varies: uses System.Str.
  685.    See also       StrBin, StrHex
  686.  
  687.    ---------------------------------------------------------------------------
  688.    StrBin function                                                        Strg
  689.    ---------------------------------------------------------------------------
  690.    Function       Converts numbers to binary strings.
  691.    Declaration    StrBin (Num: longint; Field: byte)
  692.    Result type    string
  693.    Remarks        If the field is larger than the resulting string, the field 
  694.                   is balanced with leading zeros.  If no leading zeros are 
  695.                   desired, set Field to 0.  Maximum field is 32.
  696.    Rating         13,300 str/sec
  697.    See also       StrHex, ValBin, ValHex
  698.    Example        In the following examples, the results will be String1=
  699.                   '0000111111' and String2='111111'.
  700.  
  701.                     MyByte  := 63;
  702.                     String1 := StrBin (MyByte,10);
  703.                     String2 := StrBin (MyByte,3);
  704.  
  705.    ---------------------------------------------------------------------------
  706.    StrBrk function                                                        Strg
  707.    ---------------------------------------------------------------------------
  708.    Function       Finds first character that is a member of a group of chars.
  709.    Declaration    StrBrk (S,Breaks: string; Index: byte)
  710.  
  711.  
  712.    Chapter 2, Procedures and Functions                                 Page 12
  713.    STRG Utilities                                Reference Guide, Version 5.5
  714.  
  715.  
  716.    Result type    byte
  717.    Remarks        Breaks (Brk) is a group of characters.  The function returns 
  718.                   the index of the first character found to be a member of 
  719.                   Breaks starting RIGHT from the given index.  Routine has 
  720.                   fully scanned when resulting index is zero.  This routine is 
  721.                   usually used to parse a string.  For greater speed, place 
  722.                   the most commonly used members early in Breaks.
  723.    Rating         1-char Breaks: 23,700 str/sec
  724.                   5-char Breaks:  5,400 str/sec
  725.    See also       ChrPos*, StrMemb, StrPosX, StrSpn
  726.    Example        Find the position of the number in the string S:
  727.  
  728.                     var 
  729.                       S,Numbers: string;
  730.                       Position: byte;
  731.                     begin
  732.                       S := 'Balance $24567.00';
  733.                       StrEnum (Numbers,'0','9');
  734.                       Position := StrBrk (S,Numbers,1);  { Position=10 }
  735.                     end.
  736.  
  737.    ---------------------------------------------------------------------------
  738.    StrCat* procedure                                                      Strg
  739.    ---------------------------------------------------------------------------
  740.    Function       Appends one string or substring to the end of another.
  741.    Declaration    StrCat  (VAR Dest: string; S: string; MaxLen: byte)
  742.                   StrCatX (VAR Dest: string; S: string; 
  743.                            indeX,Count,MaxLen: byte)
  744.    Remarks        This procedure appends the end of string Dest with S for a 
  745.                   maximum length limit of MaxLen.  StrCat concatenates a full 
  746.                   string while StrCatX does a substring.  This greatly speeds 
  747.                   up concatenation.  Usually the SizeOf function is used for 
  748.                   MaxLen, or 255 can be used if there is no concern.  Like 
  749.                   Concat, but up to 5 times faster.
  750.    Rating         44,100 str/sec
  751.    See also       StrCopy, StrMove, StrOvr
  752.    Example        Given S1='Eagle ' and S2='Performance', try the following:
  753.  
  754.                     StrCatX (S1,S2,7,3,255);   ( S1='Eagle man'         }
  755.                     StrCut  (S1,6);            { S1='Eagle '            }
  756.                     StrCat  (S1,S2,255);       { S1='Eagle Performance' }
  757.  
  758.    ---------------------------------------------------------------------------
  759.    StrCmp* function                                                       Strg
  760.    ---------------------------------------------------------------------------
  761.    Function       Compares one substring to another.
  762.    Declaration    StrCmp  (S1,S2: string; Index1,Index2,MaxLen: byte)
  763.                   StrCmpI (S1,S2: string; Index1,Index2,MaxLen: byte)
  764.    Result type    shortint
  765.    Result value   After comparison, here are the possible values:
  766.                     -1:  S1<S2
  767.                      0:  S1=S2
  768.                     +1:  S1>S2
  769.    Remarks        This routine compares (Cmp) two strings and determines Less 
  770.                   Than, Equal, or Greater Than.  The comparison is made 
  771.  
  772.  
  773.    Chapter 2, Procedures and Functions                                 Page 13
  774.    STRG Utilities                                Reference Guide, Version 5.5
  775.  
  776.  
  777.                   between the resulting substrings starting at each 
  778.                   corresponding index and to the right.  The indexes are not 
  779.                   adjusted should they extend beyond the end of string at 
  780.                   which the substring is considered null.  The indexes of 
  781.                   difference are saved in the global variables CmpIndex1 and 
  782.                   CmpIndex2 which are 0 if the two substrings are equal.  
  783.                   StrCmp matches case while StrCmpI ignores case.
  784.    Rating         StrCmp:  27,800 str/sec
  785.                   StrCmpI:  4,600 str/sec
  786.    Example        The following comparison of dates yields -1, CmpIndex1=13 
  787.                   and CmpIndex2=19.
  788.  
  789.                     S1 := 'MyEvent 90-04-23';
  790.                     S2 := 'Second event: 90-05-17';
  791.                     MyShortInt := StrCmp (S1,S2,9,15,8);
  792.  
  793.    ---------------------------------------------------------------------------
  794.    StrCopy procedure                                                      Strg
  795.    ---------------------------------------------------------------------------
  796.    Function       Directly copies a substring to create a new string.
  797.    Declaration    StrCopy (VAR Dest: string; S: string; Index,Count: byte)
  798.    Remarks        This is a move procedure for strings.  Being a procedure 
  799.                   rather than a function, it is up to 3.3 times faster than 
  800.                   System.Copy.  But be sure the Dest is large enough.
  801.    Rating         47,000 str/sec
  802.    See also       Copy, StrCat, StrOvr
  803.    Example        The following example extracts the substring 'target'.
  804.  
  805.                     S1 := 'This is the target word';
  806.                     StrCopy (S2,S1,13,6);           { S2='target' }
  807.  
  808.    ---------------------------------------------------------------------------
  809.    StrCut procedure                                                       Strg
  810.    ---------------------------------------------------------------------------
  811.    Function       Truncates a string above a maximum size.
  812.    Declaration    StrCut (VAR S: string; MaxLen: byte)
  813.    Rating         430,000 str/sec
  814.    See also       ChrDel*
  815.    Example        Try the following code:
  816.  
  817.                     S := 'Eagle Performance Software';
  818.                     StrCut (S,17);     { S='Eagle Performance' }
  819.  
  820.    ---------------------------------------------------------------------------
  821.    StrDeTab procedure                                                     Strg
  822.    ---------------------------------------------------------------------------
  823.    Function       Expands all tabs to spaces at a given tab spacing.
  824.    Declaration    StrDeTab (VAR Dest: string; S: string; TabSpaces: byte)
  825.    Remarks        This routine expands all tabs to spaces given the tab 
  826.                   spacing.  Source and Dest can be the same address.  Position 
  827.                   1 is the first tab setting.  Be sure Dest can handle the 
  828.                   expansion.  Strings are truncated at 255.
  829.    Rating         7,700 str/sec
  830.    See also       StrReTab
  831.    Example        Expand the tabs (#9) in the following string:
  832.  
  833.  
  834.    Chapter 2, Procedures and Functions                                 Page 14
  835.    STRG Utilities                                Reference Guide, Version 5.5
  836.  
  837.  
  838.  
  839.                     S := #9'Col 9'#9'Col 17';
  840.                     StrReTab (S,S,8);         { S='        Col 9   Col 17' }
  841.                                               {    1234567890123456789012  }
  842.  
  843.    ---------------------------------------------------------------------------
  844.    StrEnum procedure                                                      Strg
  845.    ---------------------------------------------------------------------------
  846.    Function       Enumerates a string of characters from First to Last.
  847.    Declaration    StrEnum (VAR S: string; First,Last: char)
  848.    Remarks        Enumeration can be increasing or decreasing, but do not wrap 
  849.                   through #00.  Be sure the destination is large enough.  
  850.                   Strings are truncated at 255.
  851.    Rating         13,300 str/sec
  852.    See also       StrFill, StrRev, StrSort
  853.    Example        Try the following examples:
  854.  
  855.                      StrEnum (S,'a','f');   { S='abcdeg' }
  856.                      StrEnum (T,'f','a');   { T='fedcba' }
  857.  
  858.    ---------------------------------------------------------------------------
  859.    StrFill procedure                                                      Strg
  860.    ---------------------------------------------------------------------------
  861.    Function       Fills a string with multiple copies of a substring.
  862.    Declaration    StrFill (VAR S: string; Fill: string; Count,MaxLen: byte)
  863.    Remarks        The fill overwrites S with concatenated copies of Fill.  A 
  864.                   special option is built in for single character fills to be 
  865.                   extremely fast.  Source and destination can be the same. 
  866.                   Strings are truncated by MaxLen.
  867.    Rating         1-char fill: 44,400 str/sec
  868.                   5-char fill: 13,300 str/sec
  869.    See also       ChrFill, StrEnum
  870.    Example        Try the following examples:
  871.  
  872.                     StrFill (S,'a',5,255);    { S='aaaaa' }
  873.                     StrFill (T,'Fast',3,11);  { T='FastFastFas' }
  874.  
  875.    ---------------------------------------------------------------------------
  876.    StrHex procedure                                                       Strg
  877.    ---------------------------------------------------------------------------
  878.    Function       Converts numbers to hex strings.
  879.    Declaration    StrHex (Num: longint; Field: byte)
  880.    Remarks        If the field is larger than the resulting string, the 
  881.                   field is balanced with leading zeros.  If no leading zeros 
  882.                   are desired, set Field to 0.  Maximum field is 8.  No 
  883.                   leading '$' character is inserted.
  884.    Rating         25,100 str/sec
  885.    See also       StrBin, ValBin, ValHex
  886.    Example        Try the following examples:
  887.  
  888.                     MyWord  := 4095;
  889.                     String1 := StrHex (MyWord,5);   { String1='00FFF'    }
  890.                     String2 := StrHex (MyWord,1);   { String2='FFF'      }
  891.                     String3 := StrHex (MyWord,15);  { String3='00000FFF' }
  892.  
  893.  
  894.  
  895.    Chapter 2, Procedures and Functions                                 Page 15
  896.    STRG Utilities                                Reference Guide, Version 5.5
  897.  
  898.  
  899.    ---------------------------------------------------------------------------
  900.    StrIns procedure                                                       Strg
  901.    ---------------------------------------------------------------------------
  902.    Function       Inserts a substring at a given index.
  903.    Declaration    StrIns (VAR Dest: string; S: string; DestIndex,MaxLen: byte)
  904.    Remarks        The routine is processed as if the insertion was done and 
  905.                   the resulting string truncated after MaxLen.  DestIndex is 
  906.                   adjusted to the minimum of DestIndex and Dest[0].  The 
  907.                   operation is skipped if MaxLen<DestIndex or S[0]=0.  Up to 
  908.                   5 times faster than System.Insert.
  909.    Rating         31,900 str/sec
  910.    See also       StrCat, StrCopy
  911.    Example        Try the following examples:
  912.  
  913.                     S := 'Hello friends';
  914.                     J := 'Jim';
  915.                     Index := 7;                  {    123456789012345678 }
  916.                     StrIns (S,'my ',Index,255);  { S='Hello my friends'  }
  917.  
  918.                   Since StrIns lets you control MaxLen, the following line of 
  919.                   code:
  920.  
  921.                     StrIns (S,J,Index,pred(Index)+length(J));
  922.  
  923.                   Is the same as the following two lines:
  924.  
  925.                     StrCut (S,pred(Index));   {    123456789 }
  926.                     StrCat (S,J,255);         { S='Hello Jim' }
  927.  
  928.    ---------------------------------------------------------------------------
  929.    StrJ* function                                                         Strg
  930.    ---------------------------------------------------------------------------
  931.    Function       Left, center, or right justifies a string in a field of 
  932.                   spaces.
  933.    Declaration    StrJC  (S: string; Field: byte)   { Justify center }
  934.                   StrJL  (S: string; Field: byte)   { Justify left   }
  935.                   StrJR  (S: string; Field: byte)   { Justify right  }
  936.    Result type    string
  937.    Remarks        If the field is smaller than the source string, the string 
  938.                   is simply returned unaltered.  These routines save from 
  939.                   recopying the string in the stack making it faster.
  940.    Rating         17,500 str/sec
  941.    See also       ChrPad*, StrOvr
  942.    Example        Try the following examples:
  943.  
  944.                     S := StrJC ('test',7);   { S=' test  ' }
  945.                     S := StrJL ('test',7);   { S='test   ' }
  946.                     S := StrJR ('test',7);   { S='   test' }
  947.  
  948.    ---------------------------------------------------------------------------
  949.    StrLwr procedure                                                       Strg
  950.    ---------------------------------------------------------------------------
  951.    Function       Converts strings to lower case.
  952.    Declaration    StrLwr (VAR S: string)
  953.    Remarks        The operation works on the entire string.
  954.  
  955.  
  956.    Chapter 2, Procedures and Functions                                 Page 16
  957.    STRG Utilities                                Reference Guide, Version 5.5
  958.  
  959.  
  960.    Rating         8,900 str/sec
  961.    See also       StrUpr
  962.  
  963.    ---------------------------------------------------------------------------
  964.    StrMemb procedure                                                      Strg
  965.    ---------------------------------------------------------------------------
  966.    Function       Reduces a string to its membership in ascending order.
  967.    Declaration    StrMemb (VAR Dest: string; S: string)
  968.    Remarks        Membership is the list of characters that occur in a string.  
  969.                   Only one character is listed in the destination string for 
  970.                   any number of the same character in the source string.  
  971.                   Source and destination may be the same.  This is useful when 
  972.                   repeated scans are used on the same string for speed.
  973.    Rating         4,500 str/sec
  974.    See also       Is*, StrBrk, StrSort, StrSpn
  975.    Example        Try the following example:
  976.  
  977.                     var
  978.                       S1,S2: string;
  979.                     begin
  980.                       S1 := 'Eagle Performance Software 321';
  981.                       StrMemb (S2,S1);     { S2=' 123EPSacefglmnortw' }
  982.                     end.
  983.  
  984.    ---------------------------------------------------------------------------
  985.    StrMove procedure                                                      Strg
  986.    ---------------------------------------------------------------------------
  987.    Function       Moves a string to another location WITH the length byte.
  988.    Declaration    StrMove (VAR Dest: string; S: string)
  989.    Remarks        Up to 70% faster than using and assignment (":=").  Use when 
  990.                   speed is essential.  Be sure Dest is large enough.
  991.    Rating         53,400 str/sec
  992.    See also       StrCat, StrCopy, StrOvr, StrPeek
  993.    Example        Assign a string to another:
  994.  
  995.                     S1 := 'Now is the time';
  996.                     StrMove (S2,S1);       { S2='Now is the time' }  
  997.  
  998.    ---------------------------------------------------------------------------
  999.    StrOvr procedure                                                       Strg
  1000.    ---------------------------------------------------------------------------
  1001.    Function       Overwrites a string at a given index.
  1002.    Declaration    StrOvr (VAR Dest: string; S: string; Index: byte)
  1003.    Remarks        The length of the original string is increased if the 
  1004.                   substring makes it longer.  Any gap between the two 
  1005.                   strings is filled with spaces.  This is a move-type 
  1006.                   procedure, so be sure the destination is large enough.  
  1007.                   However, resulting strings are truncated at 255.
  1008.    Rating         44,100 str/sec
  1009.    See also       Copy, StrCat, StrCopy, StrJ*, StrMove, StrPoke
  1010.    Example        Try the following examples:
  1011.  
  1012.  
  1013.  
  1014.  
  1015.  
  1016.  
  1017.    Chapter 2, Procedures and Functions                                 Page 17
  1018.    STRG Utilities                                Reference Guide, Version 5.5
  1019.  
  1020.  
  1021.                     S := 'Hello world';
  1022.                     StrOvr (S,'friends',7);   { S='Hello friends' }
  1023.                     T := 'First';             {    123456789012345678  }
  1024.                     StrOvr (T,'Last',15);     { T='First         Last' }
  1025.  
  1026.    ---------------------------------------------------------------------------
  1027.    StrPeek procedure                                                      Strg
  1028.    ---------------------------------------------------------------------------
  1029.    Function       Grabs an array in memory and converts it to a string.
  1030.    Declaration    StrPeek (VAR Dest: string; VAR Source; Count: byte)
  1031.    Remarks        Takes an array in memory at Source and converts it to a 
  1032.                   string at Dest.  Dest[0] cannot overlap Source.  This allows 
  1033.                   arrays to be handled as strings.  Not recommended for use 
  1034.                   direct to graphic memory unless the video card is known to 
  1035.                   handle 16-bit transfers.
  1036.    Rating         42,100 str/sec
  1037.    See also       StrMove, StrPoke
  1038.    Example        Try the following example:
  1039.  
  1040.                     const                      { 12345678901234567890123 }
  1041.                       A: array[1..23] of char = 'Eagle Performance, Inc.';
  1042.                     var
  1043.                       S: string;
  1044.                     begin
  1045.                       StrPeek (S,A[7],11);   { S='Performance' }
  1046.                     end.
  1047.  
  1048.    ---------------------------------------------------------------------------
  1049.    StrPoke procedure                                                      Strg
  1050.    ---------------------------------------------------------------------------
  1051.    Function       Pokes the characters of a string into memory.
  1052.    Declaration    StrPoke (VAR Dest; S: string)
  1053.    Remarks        Pokes the characters of S as an array into memory NOT 
  1054.                   including the length byte.  This allows strings to be 
  1055.                   handled as arrays.  Dest[0] cannot overlap S.  Not 
  1056.                   recommended for use direct to graphic memory unless the 
  1057.                   video card is known to handle 16-bit transfers.
  1058.    Rating         43,600 str/sec
  1059.    See also       StrOvr, StrPeek
  1060.    Example        Try the following example:
  1061.  
  1062.                     const                      { 12345678901234567890123 }
  1063.                       A: array[1..23] of char = 'Eagle            , Inc.';
  1064.                       S: string = 'Performance';
  1065.                     begin                      { 12345678901234567890123 }
  1066.                       StrPoke (A[7],S);     { A='Eagle Performance, Inc.' }
  1067.                     end.
  1068.  
  1069.    ---------------------------------------------------------------------------
  1070.    StrPos* function                                                       Strg
  1071.    ---------------------------------------------------------------------------
  1072.    Function       Finds the position of a given string with match/ignore case.
  1073.    Declaration    StrPosL  (S,Find: string; Nth: byte)
  1074.                   StrPosLI (S,Find: string; Nth: byte)
  1075.                   StrPosR  (S,Find: string; Nth: byte)
  1076.  
  1077.  
  1078.    Chapter 2, Procedures and Functions                                 Page 18
  1079.    STRG Utilities                                Reference Guide, Version 5.5
  1080.  
  1081.  
  1082.                   StrPosRI (S,Find: string; Nth: byte)
  1083.                   StrPosX  (S,Find: string; indeX: byte)
  1084.                   StrPosXI (S,Find: string; indeX: byte)
  1085.    Result type    byte
  1086.    Remarks        Using suffixes, -L routine searches from the left while the 
  1087.                   -R searches from the right for the Nth occurrence.  The -X 
  1088.                   routine starts at the given index and searches right for the 
  1089.                   first occurrence.  These routines match case, while those 
  1090.                   with the added -I suffix will Ignore case.
  1091.    Rating         StrPos?  1-char:  23,900 str/sec
  1092.                   StrPos?  5-char:  18,200 str/sec
  1093.                   StrPos?I 1-char:   6,800 str/sec
  1094.                   StrPos?I 5-char:   5,900 str/sec
  1095.    See also       ChrPos*, StrBrk
  1096.  
  1097.    ---------------------------------------------------------------------------
  1098.    StrQty* function                                                       Strg
  1099.    ---------------------------------------------------------------------------
  1100.    Function       Counts the occurrences a given substring in a string with 
  1101.                   match/ignore case. 
  1102.    Declaration    StrQty  (S,Find: string)
  1103.                   StrQtyI (S,Find: string)
  1104.    Result type    byte
  1105.    Remarks        StrQty matches case while StrQtyI ignores case.
  1106.    Rating         StrQty  1-char:  23,900 str/sec
  1107.                   StrQty  5-char:  18,200 str/sec
  1108.                   StrQtyI 1-char:   6,800 str/sec
  1109.                   StrQtyI 5-char:   5,900 str/sec
  1110.    See also       ChrQty*, WrdQty
  1111.  
  1112.    ---------------------------------------------------------------------------
  1113.    StrRepl* procedure                                                     Strg
  1114.    ---------------------------------------------------------------------------
  1115.    Function       Finds and replaces a substring from a given index for Qty 
  1116.                   number of replacements with match/ignore case. 
  1117.    Declaration    StrRepl  (VAR S: string; Find,Repl: char; 
  1118.                             Index,Qty,MaxLen: byte)
  1119.                   StrReplI (VAR S: string; Find,Repl: char;
  1120.                             Index,Qty,MaxLen: byte)
  1121.    Remarks        The operation starts from Index and goes to the right.  It 
  1122.                   will stop if the index is beyond the end of string or it has 
  1123.                   replaced as many as it can.  StrRepl matches case while 
  1124.                   StrReplI ignores case.
  1125.                     The global variable ReplToDo is the result of Qty less the 
  1126.                   number of replacements that were done on the string.
  1127.                     MaxLen is used for the special case when the length of 
  1128.                   Repl is greater than Find.  The routine will replace as many 
  1129.                   as it can.  If one more replacements would cause the string 
  1130.                   length to be greater than MaxLen, the routine will stop at 
  1131.                   that find and report the index as ReplIndex and will set 
  1132.                   ReplOverFlow=true.  Otherwise, ReplIndex=0 and ReplOverFlow 
  1133.                   is false.
  1134.    Rating         StrRepl:  8,800 str/sec
  1135.                   StrReplI: 4,600 str/sec
  1136.    See also       ChrDel*, ChrRepl*
  1137.  
  1138.  
  1139.    Chapter 2, Procedures and Functions                                 Page 19
  1140.    STRG Utilities                                Reference Guide, Version 5.5
  1141.  
  1142.  
  1143.    Example        Try the following example:
  1144.  
  1145.                     var
  1146.                       S: string;
  1147.                     begin
  1148.                           { 1234567890123456789012345678901234 }
  1149.                       S := 'Fast TEST String, FAST test string';
  1150.                       StrReplI (S,'st','---',1,255,38);
  1151.                     end.
  1152.  
  1153.                   The results will be ReplOverFlow=true, ReplIndex=30, and 
  1154.                   ReplToDo=251 with S as follows:
  1155.  
  1156.                           { 12345678901234567890123456789012345678 }
  1157.                       S := 'Fa--- TE--- ---ring, FA--- test String';
  1158.  
  1159.    ---------------------------------------------------------------------------
  1160.    StrReTab procedure                                                     Strg
  1161.    ---------------------------------------------------------------------------
  1162.    Function       Reduces spaces to tabs.
  1163.    Declaration    StrReTab (VAR Dest: string; S: string; TabSpaces: byte)
  1164.    Remarks        This routine reduces spaces with tabs given the tab spacing.  
  1165.                   Embedded tabs are accounted for.  Tab spacing is a minimum 
  1166.                   of one and zero values are forced to 1.  Position 1 is 
  1167.                   considered column 1.  Source and Dest can be the same 
  1168.                   address.
  1169.    Rating         6,000 str/sec
  1170.    See also       StrDeTab
  1171.    Example        Reduce spaces in the following string:
  1172.  
  1173.                         { 1234567890123456789012 }
  1174.                     S := '        Col 9   Col 17';
  1175.                     StrDeTab (S,S,8);         { S=#9'Col 9'#9'Col 17' }
  1176.  
  1177.    ---------------------------------------------------------------------------
  1178.    StrRev procedure                                                       Strg
  1179.    ---------------------------------------------------------------------------
  1180.    Function       Reverses the order of the characters in a string.
  1181.    Declaration    StrRev (VAR S: string)
  1182.    Rating         16,600 str/sec
  1183.    See also       StrEnum, StrSort
  1184.    Example        Try the following:
  1185.  
  1186.                     S := 'abcdefg';
  1187.                     StrRev (S);      { S='gfedcba' }
  1188.  
  1189.    ---------------------------------------------------------------------------
  1190.    StrRoll procedure                                                      Strg
  1191.    ---------------------------------------------------------------------------
  1192.    Function       Rolls the characters in a string forward or backward.
  1193.    Declaration    StrRoll (VAR S: string; Count: integer)
  1194.    Remarks        A forward roll moves characters from right to left and 
  1195.                   appends the rolled out characters on the right end.  A 
  1196.                   backward roll (a negative value) does the reverse.  If Count 
  1197.                   is greater than S[0], the Count is adjusted by mod.
  1198.  
  1199.  
  1200.    Chapter 2, Procedures and Functions                                 Page 20
  1201.    STRG Utilities                                Reference Guide, Version 5.5
  1202.  
  1203.  
  1204.    Rating         27,800 str/sec
  1205.    See also       StrRev, StrSort
  1206.    Example        Try the following:
  1207.  
  1208.                     S1 := '1234567890';  S2:=S1;
  1209.                     StrRoll (S1,2);    { S1='3456789012' }
  1210.                     StrRoll (S2,-2);   { S2='9012345678' }
  1211.  
  1212.    ---------------------------------------------------------------------------
  1213.    StrSort procedure                                                      Strg
  1214.    ---------------------------------------------------------------------------
  1215.    Function       Operates on a string by sorting it in ascending order.
  1216.    Declaration    StrSort (VAR S: string)
  1217.    Remarks        Two algorithms are used for this routine for speed.  For 
  1218.                   strings up to 22 chars long, the classic Quick Sort is used.  
  1219.                   After 22 chars, the Tally Sort is used which is up to 10 
  1220.                   times faster than Quick Sort, because the Tally Sort does it 
  1221.                   in only two passes.
  1222.    Rating         3,600 str/sec
  1223.    See also       StrEnum, StrMemb, StrRev
  1224.    Suggestions    This routine is so efficient, you can even use it to sort 
  1225.                   any byte arrays by using an absolute variable at the address 
  1226.                   you want to sort or you can use StrPeek/StrPoke for arrays 
  1227.                   up to 255 bytes.
  1228.    Example        Try the following:
  1229.  
  1230.                     S := 'fgb1edca';
  1231.                     StrSort (S);      { S='1abcdefg' }
  1232.  
  1233.    ---------------------------------------------------------------------------
  1234.    StrSpn function                                                        Strg
  1235.    ---------------------------------------------------------------------------
  1236.    Function       Counts the number of consecutive characters that are all 
  1237.                   members of a group of chars.
  1238.    Declaration    StrSpn (S,Members: string; Index: byte)
  1239.    Result type    byte
  1240.    Remarks        The function scans the string S starting at Index and scans 
  1241.                   RIGHT.  Members is any group of characters.  As long as the 
  1242.                   scanned character is in Members, it will continue to scan 
  1243.                   for the next one until it finds a non-member of Members.  
  1244.                   The result is the span (Spn) of the substring that are all 
  1245.                   members.  This routine is usually used to parse a string.  
  1246.                   For greater speed, place the most commonly used members 
  1247.                   early in Members.
  1248.    Rating         1-char Members: 23,600 str/sec
  1249.                   5-char Members:  3,600 str/sec
  1250.    See also       StrBrk, StrMemb, Wrd*, WrdParse, WrdToken
  1251.    Example        Find the length of the number in string S:
  1252.  
  1253.                     var 
  1254.                       S,Numbers: string;
  1255.                       Size: byte;
  1256.                     begin
  1257.                       S := 'Balance $24,567.00 in credits.';
  1258.                       StrEnum (Numbers,'0','9');
  1259.  
  1260.  
  1261.    Chapter 2, Procedures and Functions                                 Page 21
  1262.    STRG Utilities                                Reference Guide, Version 5.5
  1263.  
  1264.  
  1265.                       StrCat (Numbers,'+-.,',255);
  1266.                       Size := StrSpn (S,Numbers,10); { Size=9 }
  1267.                     end.
  1268.  
  1269.    ---------------------------------------------------------------------------
  1270.    StrUpr procedure                                                       Strg
  1271.    ---------------------------------------------------------------------------
  1272.    Function       Converts strings to upper case.
  1273.    Declaration    StrUpr (VAR S: string)
  1274.    Remarks        The operation works on the entire string.
  1275.    Rating         8,900 str/sec
  1276.    See also       StrLwr
  1277.  
  1278.    ---------------------------------------------------------------------------
  1279.    ValBin function                                                        Strg
  1280.    ---------------------------------------------------------------------------
  1281.    Function       Converts binary strings to longint.
  1282.    Declaration    ValBin (S: string; VAR Code: integer)
  1283.    Result type    longint (but smaller types are permissible)
  1284.    Remarks        ValBin has these superior features:
  1285.  
  1286.                     - Leading spaces are permitted but not trailing ones.
  1287.                     - Leading zeros are also permitted.
  1288.                     - A non-zero error code points to the invalid character in 
  1289.                       the string.
  1290.                     - Numbers larger than $FFFFFFFF produce an error.
  1291.                     - ValBin salvages a value even if there is an error!
  1292.                     - Routine is more flexible as a function rather than being 
  1293.                       similar to the Val procedure which is compiler dependent 
  1294.                       on the number type.
  1295.  
  1296.    Rating         25,500 str/sec
  1297.    See also       StrBin, StrHex, ValHex
  1298.    Example        In the following examples, the results will be LongInt1=100, 
  1299.                   LongInt2=500, and LongInt3=45 with Code=9.
  1300.  
  1301.                     LongInt1 := ValBin ('001100100',Code);
  1302.                     LongInt2 := ValBin ('111110100',Code);
  1303.                     LongInt3 := ValBin ('  101101b',Code);
  1304.  
  1305.    ---------------------------------------------------------------------------
  1306.    ValHex function                                                        Strg
  1307.    ---------------------------------------------------------------------------
  1308.    Function       Converts hex strings to longint.
  1309.    Declaration    ValHex (S: string; VAR Code: integer)
  1310.    Result type    longint (but smaller types are permissible)
  1311.    Remarks        ValHex has these superior features:
  1312.  
  1313.                     - Leading spaces are permitted but not trailing ones.
  1314.                     - Leading zeros are also permitted.
  1315.                     - The leading '$' is optional!
  1316.                     - A non-zero error code points to the invalid character in 
  1317.                       the string.
  1318.                     - Numbers larger than $FFFFFFFF produce an error.
  1319.                     - ValHex salvages a value even if there is an error!
  1320.  
  1321.  
  1322.    Chapter 2, Procedures and Functions                                 Page 22
  1323.    STRG Utilities                                Reference Guide, Version 5.5
  1324.  
  1325.  
  1326.                     - Twice as fast as Val and uses much less code.
  1327.                     - Routine is more flexible as a function rather than the 
  1328.                       Val procedure which is compiler dependent on the number 
  1329.                       type.
  1330.  
  1331.    Rating         27,200 str/sec
  1332.    See also       StrBin, StrHex, ValBin
  1333.    Example        In the following examples, the results will be LongInt1=100, 
  1334.                   LongInt2=500, and LongInt3=45 with Code=5.
  1335.  
  1336.                     LongInt1 := ValHex (' 0064',Code);
  1337.                     LongInt2 := ValHex (' $1f4',Code);
  1338.                     LongInt3 := ValHex ('  2Dh',Code);
  1339.  
  1340.    ---------------------------------------------------------------------------
  1341.    Wrd* procedure                                                         Strg
  1342.    ---------------------------------------------------------------------------
  1343.    Function       Parses words separated by spaces.
  1344.    Declaration    WrdL  (VAR Dest: string; S: string; Nth: byte)
  1345.                   WrdR  (VAR Dest: string; S: string; Nth: byte)
  1346.                   WrdLX (VAR Dest: string; S: string; indeX: byte)
  1347.                   WrdRX (VAR Dest: string; S: string; indeX: byte)
  1348.    Remarks        A word at the beginning or end of a string is considered a 
  1349.                   word even though it does not have spaces on both ends.  The 
  1350.                   procedures apply as follows:
  1351.  
  1352.                     WrdL  - parses Nth word from the Left
  1353.                     WrdR  - parses Nth word from the Right
  1354.                     WrdLX - parses first word from Left starting at indeX.
  1355.                     WrdRX - parses first word from Right starting at indeX.
  1356.  
  1357.                   WrdLX and WrdRX parses the first word with its first letter 
  1358.                   found in the direction of search even if it starts at indeX.
  1359.    Rating         Wrd?:  16,400 str/sec
  1360.                   Wrd?X: 25,100 str/sec
  1361.    See also       StrBrk, StrSpn, WrdPos*, WrdParse, WrdToken
  1362.    Example        Try the following parsing:
  1363.  
  1364.                     var S,W1,W2,W3,W4: string;
  1365.                     begin
  1366.                       S := 'Eagle Performance Software Products';     
  1367.                       WrdL  (W1,S,2);      { W1='Performance'}
  1368.                       WrdR  (W2,S,2);      { W2='Software'   }
  1369.                       WrdLX (W3,S,2);      { W3='Performance'}
  1370.                       WrdRX (W4,S,255);    { W1='Products'   }
  1371.                     end.
  1372.  
  1373.    ---------------------------------------------------------------------------
  1374.    WrdParse procedure                                                     Strg
  1375.    ---------------------------------------------------------------------------
  1376.    Function       Generic parsing routine.
  1377.    Declaration    WrdParse (VAR Dest: string; S,Delims: string; 
  1378.                             VAR Index: byte)
  1379.    Remarks        Delims is a group of characters considered delimiters.  
  1380.                   (Place the most used delimiters early in the string for 
  1381.  
  1382.  
  1383.    Chapter 2, Procedures and Functions                                 Page 23
  1384.    STRG Utilities                                Reference Guide, Version 5.5
  1385.  
  1386.  
  1387.                   faster performance.)  WrdParse extracts the next delimited 
  1388.                   word RIGHT from the given Index and does not search 
  1389.                   backwards.  WrdParse adjusts Index so it marks where to 
  1390.                   start the next parse on the next call.  Routine has fully 
  1391.                   scanned when resulting indeX is set to zero.  Different from 
  1392.                   WrdToken, nulls are significant; i.e., two delimiters in 
  1393.                   sequence is considered a null parse.  So, if a delimiter is 
  1394.                   at the end of a string, the final parse returned is null.
  1395.    Rating         1-char Delims: 28,500 str/sec
  1396.                   5-char Delims:  6,500 str/sec
  1397.    See also       StrBrk, StrSpn, Wrd*, WrdPos*, WrdToken
  1398.    Example        Parse the following S into the string array:
  1399.  
  1400.                     uses strg;
  1401.                     var
  1402.                       A: array[0..4] of string;
  1403.                       i,j,Index: byte;
  1404.                       D,S: string;
  1405.                     begin
  1406.                       S := 'Faster, yet better';
  1407.                       D := ' ,.';       { These are the delimiters. }
  1408.                       i := 0;           { First parse will be in Sarray[0] }
  1409.                       Index := 1;       { Start at first character }
  1410.                       while Index<>0 do
  1411.                         begin
  1412.                           WrdParse (A[i],S,D,Index);
  1413.                           inc (i);
  1414.                         end;
  1415.                     end.
  1416.  
  1417.                   Program will end with i=4 which is the number of parses 
  1418.                   found.  The results are A[0]='Faster', A[1]='', A[2]='yet', 
  1419.                   and A[3]='better'.  A[1] is null because a null string was 
  1420.                   parsed between the comma and space which is useful for 
  1421.                   parsing command line entries that are null.
  1422.  
  1423.    ---------------------------------------------------------------------------
  1424.    WrdPos* function                                                       Strg
  1425.    ---------------------------------------------------------------------------
  1426.    Function       Returns position of word delimited by spaces.
  1427.    Declaration    WrdPosL  (S: string; Nth: byte)
  1428.                   WrdPosR  (S: string; Nth: byte)
  1429.                   WrdPosLX (S: string; indeX: byte)
  1430.                   WrdPosRX (S: string; indeX: byte)
  1431.    Result type    byte
  1432.    Remarks        A word at the beginning or end of a string is considered a 
  1433.                   word even though it does not have spaces on both ends.  The 
  1434.                   procedures apply as follows:
  1435.  
  1436.                     WrdPosL  - find Nth word from the Left
  1437.                     WrdPosR  - find Nth word from the Right
  1438.                     WrdPosLX - find first word from Left starting at indeX.
  1439.                     WrdPosRX - find first word from Right starting at indeX.
  1440.  
  1441.                   If the index is not located on the first letter of a word, 
  1442.  
  1443.  
  1444.    Chapter 2, Procedures and Functions                                 Page 24
  1445.    STRG Utilities                                Reference Guide, Version 5.5
  1446.  
  1447.  
  1448.                   WrdPosLX and WrdPosRX will continue scanning for the next 
  1449.                   word.
  1450.    Rating         WrdPos?:  17,700 str/sec
  1451.                   WrdPos?X: 26,400 str/sec
  1452.    See also       StrBrk, StrSpn, Wrd*, WrdParse, WrdToken
  1453.    Example        Try the following examples:
  1454.  
  1455.                         { 12345678901234567890123456789012345678 }
  1456.                     S := 'Now is the time for all good programs.';
  1457.                     MyByte := WrdPosR  (S,1);   { MyByte=30 }
  1458.                     MyByte := WrdPosL  (S,3);   { MyByte= 8 }
  1459.                     MyByte := WrdPosLX (S,9);   { MyByte=12 }
  1460.                     MyByte := WrdPosRX (S,9);   { MyByte= 8 }
  1461.  
  1462.    ---------------------------------------------------------------------------
  1463.    WrdQty function                                                        Strg
  1464.    ---------------------------------------------------------------------------
  1465.    Function       Counts the number of words in a string delimited by spaces.
  1466.    Declaration    WrdQty (S: string)
  1467.    Result type    byte
  1468.    Remarks        A word at the beginning or end of a string is considered a 
  1469.                   word even though it does not have spaces on both ends.
  1470.    Rating         18,400 str/sec
  1471.    See also       ChrQty*, StrQty*
  1472.    Example        Try the following example:
  1473.  
  1474.                     S := 'Now is the time for all good programs.';
  1475.                     MyByte := WrdQty (S);    { MyByte=8 }
  1476.  
  1477.    ---------------------------------------------------------------------------
  1478.    WrdToken procedure                                                     Strg
  1479.    ---------------------------------------------------------------------------
  1480.    Function       Generic token parsing routine.
  1481.    Declaration    WrdToken (VAR Dest: string; S,Delims: string; 
  1482.                             VAR indeX: byte)
  1483.    Remarks        Delims is a group of characters considered delimiters.  
  1484.                   (Place the most used delimiters early in the string for 
  1485.                   faster performance.)  WrdToken extracts the next delimited 
  1486.                   word RIGHT from the given indeX and does not search 
  1487.                   backwards.  WrdToken adjusts indeX so it marks where to 
  1488.                   start the next parse on the next call.  Routine has fully 
  1489.                   scanned when resulting indeX is set to zero.  Different from 
  1490.                   WrdParse, nulls are NOT significant; i.e., all delimiters 
  1491.                   are passed over until the next token is found.  But, if a 
  1492.                   delimiter is at the end of a string, the final token 
  1493.                   returned is still null.
  1494.    Rating         1-char Delims: 28,500 str/sec
  1495.                   5-char Delims:  6,500 str/sec
  1496.    See also       StrBrk, StrSpn, Wrd*, WrdPos*, WrdParse
  1497.    Example        Parse the following S into the string array:
  1498.  
  1499.  
  1500.  
  1501.  
  1502.  
  1503.  
  1504.  
  1505.    Chapter 2, Procedures and Functions                                 Page 25
  1506.    STRG Utilities                                Reference Guide, Version 5.5
  1507.  
  1508.  
  1509.                     uses strg;
  1510.                     var
  1511.                       A: array[0..4] of string;
  1512.                       i,j,Index: byte;
  1513.                       D,S: string;
  1514.                     begin
  1515.                       S := 'Faster, yet better';
  1516.                       D := ' ,.';       { These are the delimiters. }
  1517.                       i := 0;           { First parse will be in A[0] }
  1518.                       Index := 1;       { Start at first character }
  1519.                       while Index<>0 do
  1520.                         begin
  1521.                           WrdToken (A[i],S,D,Index);
  1522.                           inc (i);
  1523.                         end;
  1524.                     end.
  1525.  
  1526.                   Program will end with i=3 which is the number of tokens 
  1527.                   found.  The results are A[0]='Faster', A[1]='yet', and 
  1528.                   A[2]='better'.
  1529.  
  1530.  
  1531.  
  1532.  
  1533.  
  1534.  
  1535.  
  1536.  
  1537.  
  1538.  
  1539.  
  1540.  
  1541.  
  1542.  
  1543.  
  1544.  
  1545.  
  1546.  
  1547.  
  1548.  
  1549.  
  1550.  
  1551.  
  1552.  
  1553.  
  1554.  
  1555.  
  1556.  
  1557.  
  1558.  
  1559.  
  1560.  
  1561.  
  1562.  
  1563.  
  1564.  
  1565.  
  1566.    Chapter 2, Procedures and Functions                                 Page 26
  1567.    STRG Utilities                                Reference Guide, Version 5.5
  1568.  
  1569.  
  1570.    3.  V A R I A B L E S
  1571.  
  1572.    There are only a few variables to consider in the STRG unit.  Some can be 
  1573.    accessed for global use and just one is local.
  1574.  
  1575.  
  1576.    GLOBAL           
  1577.  
  1578.    Global Variables - These variables can be used to assist your programs more 
  1579.    efficiently:
  1580.  
  1581.      Variable      Description
  1582.      ------------  -----------------------------------------------------------
  1583.      AscDestPtr    (Type: Pointer) After AscStr is executed, this pointer 
  1584.                    points to the next ASCIIZ destination after the end-of-
  1585.                    string null.  This is very useful for sequential 
  1586.                    conversions to save space with ASCIIZ strings.
  1587.  
  1588.      AscSrcPtr     (Type: Pointer) After StrAsc is executed, this pointer 
  1589.                    points to the next ASCIIZ source after the end-of-string 
  1590.                    null or the next valid character if the conversion is 
  1591.                    limited by MaxLen.  This is very useful for sequential 
  1592.                    conversions from contiguous ASCIIZ strings.
  1593.  
  1594.      CmpIndex1     (Type: Integer)  After strings are compared with StrCmp*, 
  1595.                    the index of difference for S1 is saved in this variable.  
  1596.                    The integer type is used in lieu of byte for the case of 
  1597.                    difference at column 256 (Index1+MaxLen>255).  If you do 
  1598.                    not use strings out to S1[255], then it is permissible to 
  1599.                    use byte assignments to this variable.
  1600.  
  1601.      CmpIndex2     (Type: Integer)  Same as CmpIndex1 except it applies to S2.
  1602.  
  1603.      LnDestPtr     (Type: Pointer) After LnStr is executed, this pointer 
  1604.                    points to the next ASCII text file destination after the 
  1605.                    end-of-string CR/LF.  This is very useful for sequential 
  1606.                    conversions to an ASCII text file for a block write.
  1607.  
  1608.      LnSrcPtr      (Type: Pointer) After StrLn is executed, this pointer 
  1609.                    points to the next ASCII text file source after the end-of-
  1610.                    string CR/LF, CR, or the next valid character if the 
  1611.                    conversion is limited by MaxLen.  This is very useful for 
  1612.                    sequential conversions from a block read of an ASCII text 
  1613.                    file.
  1614.  
  1615.      ReplIndex     (Type: Byte)  After using StrRepl* and there is an 
  1616.                    overflow, this variable provides the index where the 
  1617.                    operation was halted. 
  1618.  
  1619.      ReplOverFlow  (Type: Boolean)  After using StrRepl* when the replacement 
  1620.                    string is longer than the find string and the resulting 
  1621.                    string would be longer than MaxLen permits, this value is 
  1622.                    set to TRUE.  This means the operation went as far as it 
  1623.                    could go before overflowing the length.
  1624.  
  1625.  
  1626.  
  1627.    Chapter 3, Variables                                                Page 27
  1628.    STRG Utilities                                Reference Guide, Version 5.5
  1629.  
  1630.  
  1631.      ReplToDo      (Type: Byte)  After using StrRepl*, this variable indicates 
  1632.                    how many replacements are still needed to fulfill the 
  1633.                    original request.  If it is zero, then all replacements 
  1634.                    were done.
  1635.  
  1636.  
  1637.    LOCAL
  1638.  
  1639.    Local Constant - There is only one local constant to STRG:
  1640.  
  1641.      Constant      Description
  1642.      ------------  -----------------------------------------------------------
  1643.      ChrClass      (Type: array of char)  Several of the more complicated Is* 
  1644.                    functions use this 128 char array to quickly classify 
  1645.                    characters by testing individual bits in the array.  
  1646.                    Simpler Is* functions do not use this array and it is 
  1647.                    optimized out of the program.
  1648.  
  1649.  
  1650.  
  1651.  
  1652.  
  1653.  
  1654.  
  1655.  
  1656.  
  1657.  
  1658.  
  1659.  
  1660.  
  1661.  
  1662.  
  1663.  
  1664.  
  1665.  
  1666.  
  1667.  
  1668.  
  1669.  
  1670.  
  1671.  
  1672.  
  1673.  
  1674.  
  1675.  
  1676.  
  1677.  
  1678.  
  1679.  
  1680.  
  1681.  
  1682.  
  1683.  
  1684.  
  1685.  
  1686.  
  1687.  
  1688.    Chapter 3, Variables                                                Page 28
  1689.    STRG Utilities                                Reference Guide, Version 5.5
  1690.  
  1691.  
  1692.    4.  Q U I C K   R E F E R E N C E
  1693.  
  1694.    For a quick reference for all of the declarations contained in this unit, 
  1695.    the following are all the routines listed in alphabetical order.
  1696.  
  1697.   procedure AscStr   (VAR AscDest; S: string);
  1698.   procedure ChrDel   (VAR S: string; Find: char);
  1699.   procedure ChrDelL  (VAR S: string; Find: char);
  1700.   procedure ChrDelR  (VAR S: string; Find: char);
  1701.   procedure ChrFill  (VAR S: string; Fill: char; Count: byte);
  1702.   procedure ChrPadC  (VAR S: string; Find: char; Field: byte);
  1703.   procedure ChrPadL  (VAR S: string; Find: char; Field: byte);
  1704.   procedure ChrPadR  (VAR S: string; Find: char; Field: byte);
  1705.   function  ChrPosL  (S: string; Find: char; Nth: byte):   byte;
  1706.   function  ChrPosLI (S: string; Find: char; Nth: byte):   byte;
  1707.   function  ChrPosR  (S: string; Find: char; Nth: byte):   byte;
  1708.   function  ChrPosRI (S: string; Find: char; Nth: byte):   byte;
  1709.   function  ChrPosX  (S: string; Find: char; indeX: byte): byte;
  1710.   function  ChrPosXI (S: string; Find: char; indeX: byte): byte;
  1711.   function  ChrQty   (S: string; Find: char): byte;
  1712.   function  ChrQtyI  (S: string; Find: char): byte;
  1713.   procedure ChrRepl  (VAR S: string; Find,Repl: char; Index,Qty: byte);
  1714.   procedure ChrReplI (VAR S: string; Find,Repl: char; Index,Qty: byte);
  1715.   function  Copy     (    S: string; Index,Count: integer): string;
  1716.   procedure Delete   (VAR S: string; Index,Count: integer);
  1717.   function  IsAlNum  (C: char): boolean;
  1718.   function  IsAlpha  (C: char): boolean;
  1719.   function  IsASCII  (C: char): boolean;
  1720.   function  IsCntrl  (C: char): boolean;
  1721.   function  IsDigit  (C: char): boolean;
  1722.   function  IsDOS    (C: char): boolean;
  1723.   function  IsFile   (C: char): boolean;
  1724.   function  IsGraph  (C: char): boolean;
  1725.   function  IsLower  (C: char): boolean;
  1726.   function  IsPath   (C: char): boolean;
  1727.   function  IsPrint  (C: char): boolean;
  1728.   function  IsPunct  (C: char): boolean;
  1729.   function  IsReal   (C: char): boolean;
  1730.   function  IsSigned (C: char): boolean;
  1731.   function  IsSpace  (C: char): boolean;
  1732.   function  IsUpper  (C: char): boolean;
  1733.   function  IsXDigit (C: char): boolean;
  1734.   procedure LnStr    (VAR LnDest; S: string);
  1735.   procedure StrAsc   (VAR Dest: string; VAR AscSrc; MaxLen: byte);
  1736.   function  StrBin   (Num: longint; Field: byte): string;
  1737.   function  StrBrk   (S,Breaks: string; Index: byte): byte;
  1738.   function  StrC     (C: comp): string;
  1739.   procedure StrCat   (VAR Dest: string; S: string; MaxLen: byte);
  1740.   procedure StrCatX  (VAR Dest: string; S: string; indeX,Count,MaxLen: byte);
  1741.   function  StrCF    (C: comp; Field: integer):          string;
  1742.   function  StrCFD   (C: comp; Field,Decimals: integer): string;
  1743.   function  StrCmp   (S1,S2: string; Index1,Index2,MaxLen: byte): shortint;
  1744.   function  StrCmpI  (S1,S2: string; Index1,Index2,MaxLen: byte): shortint;
  1745.   procedure StrCopy  (VAR Dest: string; S: string; Index,Count: byte);
  1746.   procedure StrCut   (VAR S: string; MaxLen: byte);
  1747.  
  1748.  
  1749.    Chapter 4, Quick Reference                                          Page 29
  1750.    STRG Utilities                                Reference Guide, Version 5.5
  1751.  
  1752.  
  1753.   function  StrD     (D: double): string;
  1754.   procedure StrDeTab (VAR Dest: string; S: string; TabSpaces: byte);
  1755.   function  StrDF    (D: double; Field: integer):            string;
  1756.   function  StrDFD   (D: double; Field,Decimals: integer):   string;
  1757.   function  StrE     (E: extended):                          string;
  1758.   function  StrEF    (E: extended; Field: integer):          string;
  1759.   function  StrEFD   (E: extended; Field,Decimals: integer): string;
  1760.   procedure StrEnum  (VAR S: string; First,Last: char);
  1761.   procedure StrFill  (VAR S: string; Fill: string; Count,MaxLen: byte);
  1762.   function  StrHex   (Num: longint; Field: byte): string;
  1763.   procedure StrIns   (VAR Dest: string; S: string; DestIndex,MaxLen: byte);
  1764.   function  StrJC    (S: string; Field: byte): string;
  1765.   function  StrJL    (S: string; Field: byte): string;
  1766.   function  StrJR    (S: string; Field: byte): string;
  1767.   function  StrL     (L: longint):                 string;
  1768.   function  StrLF    (L: longint; Field: integer): string;
  1769.   procedure StrLn    (VAR Dest: string; VAR LnSrc; MaxLen: byte);
  1770.   procedure StrLwr   (VAR S: string);
  1771.   procedure StrMemb  (VAR Dest: string; S: string);
  1772.   procedure StrMove  (VAR Dest: string; S: string);
  1773.   procedure StrOvr   (VAR Dest: string; S: string; DestIndex: byte);
  1774.   procedure StrPeek  (VAR Dest: string; VAR Source; Count: byte);
  1775.   procedure StrPoke  (VAR Dest; S: string);
  1776.   function  StrPosL  (S,Find: string; Nth: byte):   byte;
  1777.   function  StrPosLI (S,Find: string; Nth: byte):   byte;
  1778.   function  StrPosR  (S,Find: string; Nth: byte):   byte;
  1779.   function  StrPosRI (S,Find: string; Nth: byte):   byte;
  1780.   function  StrPosX  (S,Find: string; indeX: byte): byte;
  1781.   function  StrPosXI (S,Find: string; indeX: byte): byte;
  1782.   function  StrQty   (S,Find: string):              byte;
  1783.   function  StrQtyI  (S,Find: string):              byte;
  1784.   function  StrR     (R: real): string;
  1785.   procedure StrRepl  (VAR S: string; Find,Repl: string; Index,Qty,MaxLen: byte);
  1786.   procedure StrReplI (VAR S: string; Find,Repl: string; Index,Qty,MaxLen: byte);
  1787.   procedure StrReTab (VAR Dest: string; S: string; TabSpaces: byte);
  1788.   procedure StrRev   (VAR S: string);
  1789.   function  StrRF    (R: real; Field: integer):          string;
  1790.   function  StrRFD   (R: real; Field,Decimals: integer): string;
  1791.   procedure StrRoll  (VAR S: string; Count: integer);
  1792.   function  StrS     (S: single):                          string;
  1793.   function  StrSF    (S: single; Field: integer):          string;
  1794.   function  StrSFD   (S: single; Field,Decimals: integer): string;
  1795.   procedure StrSort  (VAR S: string);
  1796.   function  StrSpn   (S,Members: string; Index: byte): byte;
  1797.   procedure StrUpr   (VAR S: string);
  1798.   function  ValBin   (S: string; VAR Code: integer): longint;
  1799.   function  ValHex   (S: string; VAR Code: integer): longint;
  1800.   procedure WrdL     (VAR Dest: string; S: string; Nth: byte);
  1801.   procedure WrdLX    (VAR Dest: string; S: string; indeX: byte);
  1802.   procedure WrdParse (VAR Dest: string; S,Delims: string; VAR Index: byte);
  1803.   function  WrdPosL  (S: string; Nth: byte):   byte;
  1804.   function  WrdPosLX (S: string; indeX: byte): byte;
  1805.   function  WrdPosR  (S: string; Nth: byte):   byte;
  1806.   function  WrdPosRX (S: string; indeX: byte): byte;
  1807.   function  WrdQty   (S: string):              byte;
  1808.  
  1809.  
  1810.    Chapter 4, Quick Reference                                          Page 30
  1811.    STRG Utilities                                Reference Guide, Version 5.5
  1812.  
  1813.  
  1814.   procedure WrdR     (VAR Dest: string; S: string; Nth: byte);
  1815.   procedure WrdRX    (VAR Dest: string; S: string; indeX: byte);
  1816.   procedure WrdToken (VAR Dest: string; S,Delims: string; VAR Index: byte);
  1817.  
  1818.  
  1819.  
  1820.  
  1821.  
  1822.  
  1823.  
  1824.  
  1825.  
  1826.  
  1827.  
  1828.  
  1829.  
  1830.  
  1831.  
  1832.  
  1833.  
  1834.  
  1835.  
  1836.  
  1837.  
  1838.  
  1839.  
  1840.  
  1841.  
  1842.  
  1843.  
  1844.  
  1845.  
  1846.  
  1847.  
  1848.  
  1849.  
  1850.  
  1851.  
  1852.  
  1853.  
  1854.  
  1855.  
  1856.  
  1857.  
  1858.  
  1859.  
  1860.  
  1861.  
  1862.  
  1863.  
  1864.  
  1865.  
  1866.  
  1867.  
  1868.  
  1869.  
  1870.  
  1871.    Chapter 4, Quick Reference                                          Page 31
  1872.