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

  1.  
  2. procedure replace_string( var line: longstring; oldstr, newstr: longstring);
  3.    (* perform string replacement if possible *)
  4. var
  5.    k: integer;
  6.    max: integer;
  7. begin
  8.    max := 10;
  9.    k := pos(oldstr,line);
  10.    while (k <> 0) and (max > 0) do
  11.    begin
  12.       line := copy(line,1,k-1) + newstr +
  13.               copy(line,k+length(oldstr),255);
  14.       k := pos(oldstr,line);
  15.       dec(max);
  16.    end;
  17. end;
  18.  
  19.