在C#中字数算法 [英] Word Count Algorithm in C#

查看:162
本文介绍了在C#中字数算法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在寻找一个好词计数类或函数。当我复制和粘贴的东西从互联网上,并将它与我的自定义字计数算法和MS Word比较它始终是关闭的一点点超过10%。我认为这是太多了。所以,不要你们知道在C#中的精确字数统计算法。

I am looking for a good word count class or function. When I copy and paste something from the internet and compare it with my custom word count algorithm and MS Word it is always off by a little more then 10%. I think that is too much . So do you guys know of an accurate word count algorithm in c#.

推荐答案

String.Split由predefined字符。使用标点符号,空格(删除多个空间),以及其他任何字符,你确定是字拆分

String.Split by predefined chars. Use punctuations, spaces (remove multiple space), and any other chars that you determine to be "word splits"

你尝试过什么?

我没看到,previous用户得到钉的链接,但这里是使用正则表达式,或者字符匹配的一些例子。希望它能帮助,没有人受到伤害X - )

I did see that the previous user got nailed for links, but here is some examples of using regex, or char matching. Hope it helps, and nobody gets hurt X-)

String.Split法(的char [])

在C#中字计数器

C#字数

这篇关于在C#中字数算法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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