Show Text Stats

Show Text Stats

Show text statistics from input.

Download show-text-stats.js
@okjson.schemaVersion 1 Show Text Stats
@okjson.description Show number of lines, total words, and total characters.
@okjson.icon paragraphsign
@okjson.openResultInNewWindow no
@okjson.preprocessInput no OK JSON
function main(string) {
  let lines = $text.countLines(string);
  let words = $text.countWords(string);
  let characters = $text.countCharacters(string);
  $'Text Stats', `${lines} lines · ${words} words · ${characters} characters`);
  return '';


I’ve seen things you people wouldn’t believe. Attack ships on fire off the shoulder of Orion. I watched C-beams glitter in the dark near the Tannhäuser Gate. All those moments will be lost in time, like tears in rain. Time to die.

The result should be 1 lines · 42 words · 230 characters.