Chapter 12 – Detecting English Programmatically 181
The previously explained getEnglishCount() function calls the removeNonLetters()
function to return a string that is the passed argument, except with all the numbers and
punctuation characters removed.
The code in removeNonLetters() starts with a blank list and loops over each character in
the message argument. If the character exists in the LETTERS_AND_SPACE string, then it is
added to the end of the list. If the character is a number or punctuation mark, then it won’t exist in
the LETTERS_AND_SPACE string and won’t be added to the list.