sub trimTo { my( $str, $n ) = @_; return $str if length $str < $n; substr( $str, 0, 1 + rindex( $str, ' ', $n-3 ) || $n-3 ) . '...'; }
In reply to Re: In search of a better way to trim string length
by BrowserUk
in thread In search of a better way to trim string
by kiat
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |