从段落中查找特定文本。 [英] Finding particular text from Paragraph.

查看:84
本文介绍了从段落中查找特定文本。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

示例文本:



医疗保健提供商正处于新兴医疗保健范式转变。随着65岁以上人口的增加和长期护理患者人数的增加,慢性病的管理现已成为现实,几乎没有争论。强调疾病管理正在转向协调慢性病的护理;这是一个乐观的观察结果。预计2060年人口增长的人口现实将超过9000万。这将占总人口的近22%(美国人口普查,2013年)。



我需要上一段中此文本的医疗保健计数值(即该单词存在多少次)

解决方案

学会自己动手:计算单词出现的次数字符串 [ ^ ]


有很多方法可以做到这一点(这里描述的大多数方法:计算字符串中的行数 [ ^ ]可以适应它。)

但是,最简单的阅读可能是:

  int  count = Regex.Matches(inputString, 保健 )。计数; 

如果你没有使用大量数据,或经常这样做,那可能就是我要去的那个。


查看此链接



http:// msdn.microsoft.com/en-us/library/bb546166.aspx [ ^ ]



http ://www.dotnetperls.com/string-occurrence [ ^

Sample Text:

"health-care providers are in the midst of a burgeoning health-care paradigm shift. As the population over age 65 increases and the number of patients in long-term care climbs, the management of chronic disease is now a reality that few debate. Emphasis on disease management is shifting to coordination of care for chronic disease; this is an optimistic observation. The demographic realities of an increasing older population are expected to eclipse 90 million in 2060. This will be nearly 22% of the total population (U.S. Census, 2013)."

I need the "health-care" count value of this text in the above paragraph(ie.How many times the word is present)

解决方案

Learn to do it yourself: Count Occurrences of a Word in a String[^]


There are a lot of ways to do this (most of the ways described here: Counting Lines in a String[^] can be adapted to do it).
But, the simplest to read is probably:

int count = Regex.Matches(inputString, "health-care").Count;

And if you aren't using large amounts of data, or doing it often, that's probably the one I'd go for.


check this link

http://msdn.microsoft.com/en-us/library/bb546166.aspx[^]

http://www.dotnetperls.com/string-occurrence[^]


这篇关于从段落中查找特定文本。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆