cutAtWord

cutAtWord ( string txt , int nbChars ) : string

Cut a string at word with a maximum of X caracters.

Example


console( cutAtWord("Hello world", 5) ) // -> Hello

Parameters

txt

string to cut

nbChars

number of characters to keep