{STRS.TPU -- Interface Definitions -- W.B. Malthouse, 1990}

{
   U T I L I T Y    F U N C T I O N S    F O R    S T R I N G S
}

Function  Ltrim(S:String)                  :String; {Left Trim}
Function  Rtrim(S:String)                  :String; {Right Trim}
Function  Trim(S:String)                   :String; {Left & Right Trim}
Function  Caps(S:String)                   :String; {Make ALL CAPS}
Function  Lowc(S:String)                   :String; {make all lower case}
Function  Icaps(S:String)                  :String; {Make Initial Caps}
Function  Cpad(S:String;L:Integer;C:Char)  :String; {Pad S to Len. L with C}
Function  Pad(S:String;L:Integer)          :String; {Pad S to Len. L with ' '}
Function  Zpad(N:Word;L:Integer)           :String; {Left-Pad with Zeroes}
Function  Center(S:String;X:Integer)       :String; {Center 'S' in 'X' Cols.}

Function  Strv(N:Word)                     :String; {Trimmed Num. to String}
Function  Strw(N:Word)                     :String; {Trimmed Num. to String}
Function  Strb(N:Byte)                     :String; {Trimmed Num. to String}
Function  Stri(N:Integer)                  :String; {Trimmed Num. to String}
Function  Strl(N:LongInt)                  :String; {Trimmed Num. to String}

Function  Rpos(T:String;S:String)          :Integer; {Last 'T' in 'S'}

Function  Translate(S:String;R:String;P:String) :String;
{
   Translate 'S', replacing all characters in 'P' with those in 'R'.
   For example:

   Raw:='ABC, DEF(G)';
                           S         R        P
                           |         |        |
   Clean:=Translate(Raw','XYZ   ','CBA(),');

   Result==> Clean:='XYZ  DEF G ';

   Replaced all 'A's with 'Z's, all 'B's with 'Y's, all 'C's with 'X's and
   replace '(', ')' and ',' with blanks.
}
Function  Verify(S:String;X:String)             :Integer;
{
   Find position of first character (if any) in 'S' which is NOT one of the
   characters in 'X'.  For example:

   Raw:='    AAAAABBBBBX    XAAAAA';
             |    |    |
             |    |    15==Verify(Raw,'BA ')
             |    |
             |    10==Verify(Raw,' A')
             |
             5==Verify(Raw,' ');

   0==Verify(Raw,'XA B') because 'Raw' is made of only 'X','A','B's and ' 's.
}
{
   Notes:

      1. Pad and Cpad will pad on the left or right as indicated by the sign
         of 'L'.  Use -L to left-pad, positive L to right-pad.

      2. Cpad will leave strings longer than 'L' alone, whereas Pad will
         truncate such strings to the absolute value of 'L'.

      3. The most common use of Translate is to replace all punctuation and
         special characters to blanks, using something like:

         Target:=Translate(Source,'','(.,;:)*+-/@#!$%^&_<>?"''');

      4. The most common use of Verify is to find the first non-blank character
         in a string by:

         NonBlank:=Verify(Source,' ');
}
