LJ::text_trim

LJ::text_trim — truncate string according to requirements on byte length, char length, or both. "char length" means number of UTF-8 characters if $LJ::UNICODE is set, or the same thing as byte length otherwise.

Use

LJ::text_trim(text, byte_max, char_max);

Arguments

  • text. the string to trim

  • byte_max. maximum allowed length in bytes; if 0, there's no restriction

  • char_max. maximum allowed length in chars; if 0, there's no restriction

Source:

cgi-bin/ljtextutil.pl

Returns:

the truncated string.