home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / TOOL_INC.ZIP / STRIPSPC.INC < prev    next >
Encoding:
Text File  |  1988-01-29  |  746 b   |  39 lines

  1.  
  2. (*------------------------------------------
  3.  *
  4.  * strip_leading_spaces
  5.  *    remove all leading spaces from a string
  6.  *
  7.  *)
  8.  
  9. procedure strip_leading_spaces(var str: anystring);
  10. var                           
  11.    p: integer;
  12.  
  13. begin
  14.    p := 1;
  15.    while (str[p] = ' ') and (p < ord(str[0])) do
  16.       p := succ(p);
  17.  
  18.    if p > 1 then
  19.       delete(str,1,p-1);
  20. end;
  21.  
  22.  
  23. (*------------------------------------------
  24.  *
  25.  * strip_trailing_spaces
  26.  *    remove all text after the first space in a string
  27.  *
  28.  *)
  29.  
  30. procedure strip_trailing_spaces(var str: anystring);
  31. var
  32.    posit:  integer;
  33. begin
  34.    posit := pos(' ',str);
  35.    if posit > 0 then
  36.       str[0] := chr(posit-1);     {remove trailing spaces and comments}
  37. end;
  38.  
  39.