HEXAQ : A friendly question - answer site for IT professionals

C# - How to count words in a given string or paragraph?


0

In my web site I want to allow users to submit their content not more than 1000 words.

How can I count the total words in submitted content?

Â
asked
 


≡ Total 1 Answer

0

Check this

string s = "Sample string to count words";int i = Regex.Matches(s, @"[\S]+").Count;

You can do in same way using Regular Expression.

Â
replied


Enter your reply here
Answer Preview: