User-698857717 posted
Hello All,
I need to implement a functionality where I need to replace some HTML tags from a large HTML string with some values from database. I have implemented this using the following code, but it is taking too long when the data is very heavy. Is there a way to
make it faster. May be by using Linq or using some other approach:
For index = 0 To ArrayDynamicValues.Length - 1
Dim item As String() = ArrayDynamicValues(index).Split(New String() {","}, StringSplitOptions.None)
Dim strFind = item(0)
Dim m As Match = Regex.Match(HTMLText, strFind, RegexOptions.IgnoreCase)
Do While m.Success
Dim AfterContent As String = _HTMLText.Substring(m.Index)
Dim startIndex = m.Index + AfterContent.IndexOf(">") + 1
Dim endIndex = m.Index + AfterContent.IndexOf("<")
_HTMLText= _HTMLText.Substring(0, startIndex ) + item(1) + _HTMLText.Substring(endIndex )
m = m.NextMatch()
Loop
Next
Thanks in Advance !!
Gurpreet Singh