The Title says everything..
Searched Google and Stackoverf开发者_开发问答low and didn't find something similiar..
For .txt file you can use regexp \b\w+\b. It will match all occurrences of words, e.g.:
var count = Regex.Matches(input, @"\b\w+\b").Count;
To count letters:
int count = input.Count(char.IsLetter);
static void Main()
{
     const string t1 = "To be or not to be, that is the question.";
     Console.WriteLine(WordCounting.CountWords1(t1));
     Console.WriteLine(WordCounting.CountWords2(t1));
     const string t2 = "Mary had a little lamb.";
     Console.WriteLine(WordCounting.CountWords1(t2));
     Console.WriteLine(WordCounting.CountWords2(t2));
}
more is here
getting text from rtf - Get plain text from an RTF text
count words in text - http://www.dotnetperls.com/word-count
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论