Login +

Documentation

SLS_String::trimStringToLength

Since SillySmart 1.0

Description

Cut a string at a given length without truncate a word
static string trimStringToLength ( string $string, int $length, [ bool $more ] );

Parameters

  • string $string
    the string to cut
  • int $length
    the wanted length
  • bool $more
    if you want to concatenate '...' at the end of the string

Return

string $trimmed
the string cut

Exemples

  •  var_dump(SLS_String::trimStringToLength("software is like sex, it's better when it's free",25));
     // will produce "software is like sex,..."
  •  var_dump(SLS_String::trimStringToLength("software is like sex, it's better when it's free",25,false));
     // will produce "software is like sex,"

Comments

No comment on this function, be the first !

Add your comment

You must login/register to post a reply.