VB.NET - It keep replacing itself

Deadly 提交于 2019-12-03 21:32:29

Due to the format the words are stored in, it will be much easier to achieve what you want using Regular Expressions:

Dim lines = File.ReadLines("C:\text.txt")
For Each line As String In lines
    Dim pat = String.Format("\b({0})\b", line)
    RichTextBox1.Text = Regex.Replace(RichTextBox1.Text, pat, line)
Next

This should do pretty much what you want.

Check it here.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!