PHP字符过滤函数去除字符串最后一个逗号(rtrim)
2013-03-26 22:59
1046 查看
首先分别解释下,
trim过滤字符串两端,
rtrim过滤字符串尾部,=chop()
ltrim过滤字符串首部.
过滤字符串中键的咚咚就只能用str_replace咯.
举个例子说明下,
PHP代码
$str = '123,333,234,';
echo rtrim($str, ',');
rtrim实例代码2
<?php
$text = "\t\tThese are a few words :) ... ";
$trimmed = rtrim($text);
// $trimmed = "\t\tThese are a few words :) ..."
$trimmed = rtrim($text, " \t.");
// $trimmed = "\t\tThese are a few words :)"
$clean = rtrim($binary, "\x00..\x1F");
// trim the ASCII control characters at the end of $binary
// (from 0 to 31 inclusive)
?>
您可能感兴趣的文章:
相关文章推荐
- PHP字符过滤函数去除字符串最后一个逗号(rtrim)
- PHP字符过滤函数去除字符串最后逗号
- PHP去除字符串最后一个字符的三种方法实例
- PHP 字符串去除 trim、ltrim 与 rtrim 函数
- PHP字符串去除最后一个逗号
- php去除字符串开头或末尾的字符(例如逗号)
- 函数stripslashes去除转义 shopnc 搜索框过滤特殊字符 输入单斜杆会自动转义
- 总结PHP删除字符串最后一个字符的三种方法
- 写函数去除字符串中包含的非字母字符(不包括空格),将小写字母转换成大写字母
- PHP中字符安全过滤函数使用小结
- PHP中字符安全过滤函数使用小结
- 去除字符串前后的逗号;验证特殊字符
- PHP 过滤 及 字符转换 函数
- PHP中ltrim与rtrim去除左右空格及特殊字符实例
- php去掉字符串中的最后一个字符
- php去掉字符串的最后一个字符
- php ucwords() 函数将字符串中每个单词的首字符转换为大写(实现代码)
- PHP UTF-8字符串截断函数实现中文字符的无乱码截断
- PHP 将逗号、空格、回车分隔的字符串转换为数组的函数