Private Sub ReplaceString(ByRef Expression As String, ByVal sLeft As String, ByVal sRight As String, ByVal sReplace As String, Optional ByVal iStart As Integer = 0)
Dim iPosL As Integer = Expression.IndexOf(sLeft, iStart)
If iPosL > -1 Then
Dim iPosR As Integer = Expression.IndexOf(sRight, iPosL + sLeft.Length)
If iPosR > -1 Then
Expression = String.Format("{0}{1}{2}", Expression.Substring(0, iPosL + sLeft.Length), sReplace, Expression.Substring(iPosR, Expression.Length - iPosR))
End If
End If
End Sub
'Dim sStr As String = "<div align='center'>machin</div>"
'ReplaceString(sStr, "'>", "<", "budule")
'MessageBox.Show(sStr)