home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C!T ROM 2
/
ctrom_ii_b.zip
/
ctrom_ii_b
/
PROGRAM
/
BASIC
/
PBC22
/
SOURCES
/
REPLACST.BAS
< prev
next >
Wrap
BASIC Source File
|
1993-01-01
|
878b
|
25 lines
' +----------------------------------------------------------------------+
' | |
' | PBClone Copyright (c) 1990-1993 Thomas G. Hanlin III |
' | |
' +----------------------------------------------------------------------+
SUB ReplaceString (St$, Old$, New$, Found%, ErrCode%)
Found% = 0
IF LEN(Old$) THEN
ErrCode% = 0
IF Old$ <> New$ THEN
tmp% = INSTR(St$, Old$)
IF tmp% THEN
DO
St$ = LEFT$(St$, tmp% - 1) + New$ + MID$(St$, tmp% + LEN(Old$))
tmp% = INSTR(tmp% + LEN(New$), St$, Old$)
LOOP WHILE tmp%
Found% = -1
END IF
END IF
ELSE
ErrCode% = -1
END IF
END SUB