Function cApiStrTrimAfterWord
Trims a string to a given length and makes sure that all words up to $maxlen are preserved, without exceeding $maxlen.
Warning: Currently, this function uses a regular ASCII-Whitespace to do the separation test. If you are using ' ' to create spaces, this function will fail.
Example: $string = "This is a simple test"; echo cApiStrTrimAfterWord ($string, 15);
This would output "This is a", since this function respects word boundaries and doesn't operate beyond the limit given by $maxlen.
Package: Core\Backend
Copyright: four for business AG <www.4fb.de>
License: http://www.contenido.org/license/LIZENZ.txt
Author: Timo Hummel
Located at includes/functions.api.string.php
Copyright: four for business AG <www.4fb.de>
License: http://www.contenido.org/license/LIZENZ.txt
Author: Timo Hummel
Located at includes/functions.api.string.php
string |
$string |
The string to operate on |
integer |
$maxlen |
The maximum number of characters |
string
|
The resulting string |