Листинг 4. Варианты реализация функции Replase традиционными средствами Basic
Function ReplaceMy$(Source$, LookFor$, ReplaceWith$)
'
'	Замена кода строкой переменной
'=====================================
	Dim strTemp$, iStart%, iStrLen%
	strTemp$ = Source$
	If Len(strTemp$) > 0 Then
		iStart% = 1
		iStrLen% = Len(ReplaceWith$)
		Do
			iStart% = InStr(iStart%, strTemp$, LookFor$)
			If iStart% = 0 Then Exit Do
			strTemp$ = Left$(strTemp$, iStart% - 1) + _
				ReplaceWith$ + _
				Mid$(strTemp$, iStart% + Len(LookFor$))
			iStart% = iStart% + iStrLen%
		Loop
	End If
	ReplaceMy$ = strTemp$
End Function
