From 7946a6e925726fb05f22c73bb860da991a0d9a3a Mon Sep 17 00:00:00 2001 From: Caleb Fontenot Date: Tue, 4 Apr 2023 17:43:57 -0500 Subject: [PATCH] Add countChars function --- commands/countChars.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/commands/countChars.ts b/commands/countChars.ts index 325bfad..e4a31f3 100644 --- a/commands/countChars.ts +++ b/commands/countChars.ts @@ -47,6 +47,9 @@ function countChars(string) { 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 (currentChar.charCodeAt(0) == 32) { + currentChar = "whitespace" + } if (letterCount[i] > 0) { outputString += "Number of " + currentChar + "'s: " + letterCount[i] + "\n"; }