在句子中找到一个单词 [英] find a word in sentence
本文介绍了在句子中找到一个单词的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨
i有一个文本框,并且写了一个名字,我想知道例如在该名称中有多少像a这样的词我想要数它
With Respect
Hi
i have a textbox and ill write one name in that and i want to know for example how many word like "a" in that name i want to count it
With Respect
推荐答案
这样做
Do like this
textBox1.Text = "abc";
int count = textBox1.Text.Count(f => f == 'a');
或
or
int count1 = Regex.Matches(textBox1.Text, "a").Count;
这篇关于在句子中找到一个单词的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文