Home

Add

Edit

Without Linenumbers

Code in Textfield

Download

  1. Function Replace(Byval V_Data As String, Byval V_Expression As String, Byval V_ReplaceBy As String) As String
    
  2. If Len(V_Data) < Len(V_Expression) Then Return V_Data
    
  3. Dim D As String = V_Data
    
  4. Dim SL As Uinteger = Len(V_Expression)
    
  5. Dim X As Uinteger = 0
    
  6. Do
    
  7.     X += 1
    
  8.     If X > Len(D) - SL + 1 Then Exit Do
    
  9.     If Mid(D, X, SL) = V_Expression Then
    
  10.         D = Mid(D, 1, X - 1) & V_ReplaceBy & Mid(D, X + SL)
    
  11.         X -= (SL - 1)
    
  12.         If X < 0 Then X = 0
    
  13.     End If
    
  14. Loop
    
  15. Return D
    
  16. End Function