diff --git a/commands/countChars.ts b/commands/countChars.ts index d83258d..325bfad 100644 --- a/commands/countChars.ts +++ b/commands/countChars.ts @@ -43,8 +43,12 @@ function countChars(string) { letterCount[arrayIndex]++; } for (let i = 0; i < letterCount.length; ++i) { + let currentChar = String.fromCharCode(i).toUpperCase();; + if (currentChar.charCodeAt(0) == 10 || currentChar.charCodeAt(0) == 13 || currentChar.charCodeAt(0) == 30 || currentChar.charCodeAt(0) == 115 || currentChar.charCodeAt(0) == 21 || currentChar.charCodeAt(0) == 118) { + currentChar = "newline"; + } if (letterCount[i] > 0) { - outputString += "Number of " + String.fromCharCode(i).toUpperCase() + "'s: " + letterCount[i] + "\n"; + outputString += "Number of " + currentChar + "'s: " + letterCount[i] + "\n"; } } return outputString;