我如何逐字搜索(或得到)?

isx*_*ker 1 c# string search

我有一个单词和文字.我必须找到所有提出这个词的提案.你有什么主意吗?

piblic List<string> GetSnetences(string word)
{
    // search all proposals that have the word
{
Run Code Online (Sandbox Code Playgroud)

Yuc*_*uck 5

尝试做这样的事情:

var text =
    "Here is some text. It has some sentences. There are a few sentences.";
var word = "SOME";

public List<String> GetSentences(String text, String word) {
    var sentences =
        text.Split(new[] { ". " }, StringSplitOptions.RemoveEmptyEntries);

    var matches = from sentence in sentences
                  where sentence.ToLower().Contains(word.ToLower())
                  select sentence;

    return matches.ToList();
}
Run Code Online (Sandbox Code Playgroud)

最后,匹配将是一个枚举,其中包含您要搜索的单词的所有句子.