How do I truncate strings? For example, I need to truncate the following text.


  Drupal is free, flexible, robust and constantly being improved by hundreds of thousands of passionate people from all over the world. Join us!


I have used drupal_substr(), but the result may be "Drupal is free, flexi."
How can I avoid to truncate a word?
You need to use truncate_utf8() using $wordsafe = TRUE;


  $wordsafe Flag to truncate at last space within the upper limit. Defaults to FALSE.