Guest User

Untitled

a guest
Jan 22nd, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 1.07 KB | None | 0 0
  1.     Private Function UnblackList(ByVal code As String) As String
  2.         If code.Trim = String.Empty Then
  3.             Return String.Empty
  4.         Else
  5.             Dim path As String = Application.StartupPath & "\data\words.black"
  6.             If Not File.Exists(path) Then
  7.                 Return code
  8.             Else
  9.                 'Load words
  10.                 Dim words() As String = File.ReadAllLines(path)
  11.                 'check the words one by one and replace theme by adding <font></font> in the middle
  12.                 For i As Integer = 0 To words.Length - 1
  13.                     Dim position As Integer = 0
  14.                     Do
  15.                         position = code.IndexOf(words(i), position)
  16.                         If position <> -1 Then
  17.                             'Insert <font></font> after the first character
  18.                             code.Insert(position + 1, "<font></font>")
  19.                         End If
  20.                     Loop While position <> -1
  21.                 Next
  22.                 Return code
  23.             End If
  24.         End If
  25.     End Function
Add Comment
Please, Sign In to add comment