nirisan
asked on
How do i replace multiple characters in a string using vb.net
I want to replace multiple characters in a string.
presently im doing this shown in code.
I want to be able to replace the string with multiple known chars like, "<b>" ,"</b>", "<p>", <br> with empty string "".
Please suggest with code.
presently im doing this shown in code.
I want to be able to replace the string with multiple known chars like, "<b>" ,"</b>", "<p>", <br> with empty string "".
Please suggest with code.
Dim txtVal as String
txtVal= txtVal.Replace("<BR>", "")
or
Dim txtVal as String
txtVal= txtVal.Replace("<BR>",
txtVal= txtVal.Replace("<b>","")
txtVal= txtVal.Replace("</b>","")
...
ASKER
thanks for your reply, but is possible to put in through a loop and give toReplace parameters.
ASKER
thanks for your reply, but is it possible to put it in a loop and give toReplace parameters?
try like this
Dim a As String = "<br>test<b>wew><</b>wewew ew</br><i> wewe</i>", a1 As String
Dim strReplace As String() = {"<br>", "</br>", "<b>"}
a1 = String.Join("", a.Split(strReplace, StringSplitOptions.None))
Dim a As String = "<br>test<b>wew><</b>wewew
Dim strReplace As String() = {"<br>", "</br>", "<b>"}
a1 = String.Join("", a.Split(strReplace, StringSplitOptions.None))
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks!
Open in new window