Word Count Algorithm in C#

前端 未结 7 1472
天涯浪人
天涯浪人 2021-01-05 02:37

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

7条回答
  •  再見小時候
    2021-01-05 03:10

    You also need to check for newlines, tabs, and non-breaking spaces. I find it best to copy the source text into a StringBuilder and replace all newlines, tabs, and sentence ending characters with spaces. Then split the string based on spaces.

提交回复
热议问题