How to count words frequency by removing non-letters of a string?
问题 I have a string: var text = @" I have a long string with a load of words, and it includes new lines and non-letter characters. I want to remove all of them and split this text to have one word per line, then I can count how many of each word exist." What is the best way to go about removing all non-letter characters, then splitting each word onto a new line so I can store and count how many of each word there are? var words = text.Split(' '); foreach(var word in words) { word.Trim(',','.','-'