2014-04-18 68 views
0

我有两个文件,每个文件中有4000个单词。我想在每个字的后面添加一个符号,以便在正则表达式模式中使用它们。这就是开始(不是很多..):在文本文件中的每个单词之后添加一个符号

Dim Positive_Words As String 
    Dim Negative_Words As String 


    Positive_Words = My.Computer.FileSystem.ReadAllText("C:\positive.txt") 
    Negative_Words = My.Computer.FileSystem.ReadAllText("C:\negative.txt") 

    For Each word As String In Positive_Words 

     'What i need to write here in order to add a symbol "|" after every word? 

    Next 

问题:

  • 有没有办法在VB或以任何其他方式(2013字或其他任何东西),要做到这一点?
  • 可以接受4000+的正则表达式吗?
+0

与替代空间'|'应该是可以接受你,然后 – aelor

+0

我怎么能做到这一点? – ILoveMom

+0

这对我来说有点奇怪,但你几乎可以在任何编辑器中做到这一点。 – aelor

回答

0
Dim Positive_Words As String 
Dim Negative_Words As String 


Positive_Words = My.Computer.FileSystem.ReadAllText("C:\positive.txt").Replace(" ", "|") 
Negative_Words = My.Computer.FileSystem.ReadAllText("C:\negative.txt").Replace(" ", "|") 
+1

由于OP表示“添加符号”,替换文本应该是“”|“',而不仅仅是”“”“。但是,死了很简单。 –

相关问题