home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #1 / monster.zip / monster / PROG_BAS / PBC23C.ZIP / 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.