Friday, May 8, 2020

[VB][example] Remove Betwwen Strings

Public Function RemoveBetwwenStrings(ByVal source As String, ByVal prefix As String, ByVal surfix As String) As String
  Dim prefixInd As Integer = source.Indexod(prefix)
  Dim surfixInd As Integer = source.Indexod(surfix)
  Dim len As Integer = (surfixInd - prefixind) + surfix.Length
  Dim result As String = source
  if prefixind >=0 And surfixInd >=0 and len>0 Then
    Dim subStr As String = source.Substring(prefixInd, len)
    result = source.Replace(subStr, String.Empy)
    if result.Contains(prefix) Then
      result = RemoveBetwwenStrings(result, prefix, surfix)
    End If
  End If
  RemoveBetwwenStrings = result
End Function

No comments :

Post a Comment