home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 13 / CD_ASCQ_13_0494.iso / maj / 419 / replacst.bas < prev    next >
BASIC Source File  |  1994-03-13  |  878b  |  25 lines

  1. '   +----------------------------------------------------------------------+
  2. '   |                                                                      |
  3. '   |        PBClone  Copyright (c) 1990-1994  Thomas G. Hanlin III        |
  4. '   |                                                                      |
  5. '   +----------------------------------------------------------------------+
  6.  
  7. SUB ReplaceString (St$, Old$, New$, Found%, ErrCode%)
  8.    Found% = 0
  9.    IF LEN(Old$) THEN
  10.       ErrCode% = 0
  11.       IF Old$ <> New$ THEN
  12.          tmp% = INSTR(St$, Old$)
  13.          IF tmp% THEN
  14.             DO
  15.                St$ = LEFT$(St$, tmp% - 1) + New$ + MID$(St$, tmp% + LEN(Old$))
  16.                tmp% = INSTR(tmp% + LEN(New$), St$, Old$)
  17.             LOOP WHILE tmp%
  18.             Found% = -1
  19.          END IF
  20.       END IF
  21.    ELSE
  22.       ErrCode% = -1
  23.    END IF
  24. END SUB
  25.