1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
Public Class MyString
Inherits String
Public Function ReplaceNoCase(oldValue As String, newValue As String) As String
Dim myTextTmp As string
Dim iPos As Integer
Dim bContinue As Boolean
myTextTmp = Me.Text.ToLower
bContinue = True
While bContinue
iPos = myTextTmp.IndexOf(oldValue.ToLower)
If iPos = -1 Then
bContinue = False
Else
Me.Text = Me.Text.Replace(Me.Text.SubString(iPos, oldValue.Length), _
newValue)
myTextTmp = Me.Text
End If
End While
Return Me.Text
End function
End Class |
Partager