VB.net删除括在括号中的单词 [英] VB.net-delete words inclosed in a bracket
本文介绍了VB.net删除括在括号中的单词的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何删除VB.NET中字典括号中的单词?例如
适得其反(表示负面或不良效果)
How do you delete words inclosed in a bracket in a dictionary in VB.NET? E.g.
counterproductive (It means Negative or bad effect)
推荐答案
在字符串中执行此操作是简单的正则表达式:
To do it in a string is simple with a regex:
Public Dim regex As Regex = New Regex( _
"\(.+\)", _
RegexOptions.Singleline _
Or RegexOptions.CultureInvariant _
Or RegexOptions.Compiled _
)
...
' Replace the matched text in the InputText using the replacement pattern
Dim result As String = regex.Replace(InputText,"")
然后,您只需将其应用于集合中的每个字符串。
Then all you have to do apply that to each string in your collection.
这篇关于VB.net删除括在括号中的单词的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文