Home

Add

Edit

With Linenumbers

Code in Textfield

Download

Function Replace(Byval V_Data As String, Byval V_Expression As String, Byval V_ReplaceBy As String) As String
If Len(V_Data) < Len(V_Expression) Then Return V_Data
Dim D As String = V_Data
Dim SL As Uinteger = Len(V_Expression)
Dim X As Uinteger = 0
Do
    X += 1
    If X > Len(D) - SL + 1 Then Exit Do
    If Mid(D, X, SL) = V_Expression Then
        D = Mid(D, 1, X - 1) & V_ReplaceBy & Mid(D, X + SL)
        X -= (SL - 1)
        If X < 0 Then X = 0
    End If
Loop
Return D
End Function