17-10-12, 10:56 PM
كاتب الموضوع : Boutemine Oualid
الساام عليكم و رحمة الله و بركاتهكود :
Imports System.Text.RegularExpressions
Private Function BoldWord(ByVal words As String(), ByVal text As String) As String
Dim regex As Regex
Dim _words As String = String.Join("\b|\b", words)
regex = New System.Text.RegularExpressions.Regex("\b" + _words + "\b", RegexOptions.IgnoreCase)
Return regex.Replace(text, AddressOf _BoldWord)
End Function
Private Function _BoldWord(ByVal m As Match) As String
Return "<b>" + m.Value + "</b>"
End Function
'How to use:
BoldWord(NewString() {"BoldWord"}, "make bold the BoldWord")