选择语言 :

 Core_UTF8::rtrim

Strips whitespace (or other UTF-8 characters) from the end of a string. This is a UTF8-aware version of rtrim.

$str = UTF8::rtrim($str);

string Core_UTF8::rtrim( string $str [, string $charlist = null ] )
author
Andreas Gohr andi@splitbrain.org

参数列表

参数 类型 描述 默认值
$str string Input string
$charlist string String of characters to remove null
返回值
  • string
File: ./core/classes/utf8.class.php
public static function rtrim($str, $charlist = null)
{
    if ( $charlist === null ) return rtrim($str);

    if ( UTF8::is_ascii($charlist) ) return rtrim($str, $charlist);

    $charlist = preg_replace('#[-\[\]:\\\\^/]#', '\\\\$0', $charlist);

    return preg_replace('/[' . $charlist . ']++$/uD', '', $str);
}