charCount function
Counts the number of characters in str.
filterNonChars removes non-chars from count.
Implementation
int charCount(String str, {bool filterNonChars = true}) {
if (filterNonChars) {
return str.runes.where(isChar).length;
} else {
return str.runes.length;
}
}