【发布时间】:2018-04-21 02:44:46
【问题描述】:
在 ASP.NET C# 中并假设我有一个字符串包含逗号分隔的单词:
string strOne = "word,WordTwo,another word, a third long word, and so on";
如何拆分然后与可能包含或不包含这些单词的另一个段落进行比较:
string strTwo = " when search a word or try another word you may find that WordTwo is there with others";
那么如何在第三个字符串中输出这些以逗号分隔的常用词
string strThree = "output1, output2, output3";
要得到类似的结果:"word, WordTwo, another word,"
【问题讨论】:
-
这与 asp.net 有什么关系。这不只是一个 C# 问题吗?
-
用逗号分割
strOne,用空格分割strTwo。然后使用intersectLINQ 方法获取两个数组中存在的常用词。 stackoverflow.com/questions/10323071/… -
可能是因为我正在构建一个 ASP.NET 应用程序:),应该删除它:)
-
你希望输出重复单词还是不同
-
不要只得到他们一次@TheGeneral