NAME

GoSaveTool::Text - Word count, reading time, social media limits, Title Case, slugs and whitespace cleanup

SYNOPSIS

use utf8;
use GoSaveTool::Text qw(stats limits title slug);

my $st = stats('Hello world. It’s 2026!');
# { words => 4, chars => 23, charsNoSpaces => 20, lines => 1, sentences => 2, readSeconds => 1 }

print limits($caption)->{'instagram-caption'}{left}, " characters left\n";
print title('the lord of the rings'), "\n";   # The Lord of the Rings
print slug('Ölçü Birimi & Çeviri!'), "\n";    # olcu-birimi-ceviri

DESCRIPTION

The Perl version of the @gosavetool/text JavaScript package, from GoSaveTool, free online tools for creators. The same counter is online at https://www.gosavetool.com/character-counter.

All functions take and return character strings (decode your input first, for example with open my $fh, '<:encoding(UTF-8)', $file). Characters are Unicode code points, so an emoji counts as one.

FUNCTIONS

Nothing is exported by default.

stats($text)

Hash reference with words, chars, charsNoSpaces, lines, sentences and readSeconds (at 238 words a minute).

limits($text, @fields)

Hash reference of { limit, used, left, fits } for each field of %LIMITS, or only the given fields: x-post, instagram-caption, tiktok-caption, youtube-title, youtube-description, linkedin-post, pinterest-description, seo-title, meta-description.

title($text), sentence($text), upper($text), lower($text)

Case changes. Title Case keeps short words (a, of, the, and...) in lower case unless they start the text or follow a colon.

slug($text), camel($text), snake($text), kebab($text)

olcu-birimi-ceviri, bestPostingTime, best_posting_time, best-posting-time.

words($text)

The words camel, snake and kebab join.

clean($text)

Removes trailing spaces, runs of spaces and more than one blank line in a row.

SEE ALSO

GoSaveTool::Subtitles

AUTHOR

GoSaveTool https://www.gosavetool.com/

LICENSE

MIT License. See the LICENSE file.