mb_rtrim
(PHP 8 >= 8.4.0)
mb_rtrim — Strip whitespace (or other characters) from the end of a string
说明
Performs a multi-byte safe rtrim() operation,
and returns a string with whitespace (or other characters) stripped from the
end of string.
Without the second parameter, mb_rtrim() will strip these characters:
-
" "(Unicode U+0020),普通空格。 -
"\t"(Unicode U+0009),制表符。 -
"\n"(Unicode U+000A),新行(换行)。 -
"\r"(Unicode U+000D),回车。 -
"\0"(Unicode U+0000),NUL 字节。 -
"\v"(Unicode U+000B),垂直制表符。 -
"\f"(Unicode U+000C),换页符。 -
"\u00A0"(Unicode U+00A0),NO-BREAK SPACE。 -
"\u1680"(Unicode U+1680),OGHAM SPACE MARK。 -
"\u2000"(Unicode U+2000),EN QUAD。 -
"\u2001"(Unicode U+2001),EM QUAD。 -
"\u2002"(Unicode U+2002),EN SPACE。 -
"\u2003"(Unicode U+2003),EM SPACE。 -
"\u2004"(Unicode U+2004),THREE-PER-EM SPACE。 -
"\u2005"(Unicode U+2005),FOUR-PER-EM SPACE。 -
"\u2006"(Unicode U+2006),SIX-PER-EM SPACE。 -
"\u2007"(Unicode U+2007),FIGURE SPACE。 -
"\u2008"(Unicode U+2008),PUNCTUATION SPACE。 -
"\u2009"(Unicode U+2009),THIN SPACE。 -
"\u200A"(Unicode U+200A),HAIR SPACE。 -
"\u2028"(Unicode U+2028),LINE SEPARATOR。 -
"\u2029"(Unicode U+2029),PARAGRAPH SEPARATOR。 -
"\u202F"(Unicode U+202F),NARROW NO-BREAK SPACE。 -
"\u205F"(Unicode U+205F),MEDIUM MATHEMATICAL SPACE。 -
"\u3000"(Unicode U+3000),IDEOGRAPHIC SPACE。 -
"\u0085"(Unicode U+0085),NEXT LINE (NEL)。 -
"\u180E"(Unicode U+180E),MONGOLIAN VOWEL SEPARATOR。
参数
string- The input string.
characters-
可选,也可以使用
characters参数指定要删除的字符。只需列出所有需要删除的字符即可。 encoding-
encoding参数为字符编码。如果省略或是null,则使用内部字符编码。
返回值
Returns the modified string.
参见
- mb_trim() - Strip whitespace (or other characters) from the beginning and end of a string
- mb_ltrim() - Strip whitespace (or other characters) from the beginning of a string
- rtrim() - 去除字符串末尾的空白字符(或者其他字符)
+添加备注
用户贡献的备注
此页面尚无用户贡献的备注。