Skip to content

Commit 649d5b2

Browse files
committed
Add commas for thousands separator for text counter output
1 parent 29b2323 commit 649d5b2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

scala-js/src/main/scala/textcounter/TextCounter.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ object TextCounter {
1313
"click",
1414
(e: dom.MouseEvent) => {
1515
val textInput = textContent.value
16-
val characters = textInput.length
17-
val words = textInput.trim.split("\\s+").length
18-
val lines = textInput.split("\\n").length
16+
val characters = "%,d".format(textInput.length)
17+
val words = "%,d".format(textInput.trim.split("\\s+").length)
18+
val lines = "%,d".format(textInput.split("\\n").length)
1919
textOutput.textContent =
2020
s"Characters: $characters\nWords: $words\nLines: $lines"
2121
}

0 commit comments

Comments
 (0)