/** * UTF-8 aware replacement for trim() * * Strip whitespace (or other characters) from the beginning and end of a string * Note: you only need to use this if you are supplying the charlist * optional arg and it contains UTF-8 characters. Otherwise trim will * work normally on a UTF-8 string * * @param string the string to be trimmed * @param string the optional charlist of additional characters to trim * @return string the trimmed string * @see http://www.php.net/trim */ public static function trim($str, $charlist = FALSE) { if ($charlist === FALSE) { return trim($str); } return KHelperString::ltrim(utf8_rtrim($str, $charlist), $charlist); }