更新时间:2023-02-19 12:35:46
看看这个...
> http://code.google.com/p/php-string/downloads/detail?name=string.php&can=2&q=
该类支持mbstring和iconv扩展,以及软件包PHP-UTF8.它为每种方法选择***的可用功能.此外,它提供了许多新方法.其中一些是:substringBetween,splice,startWith,endsWith和squeeze.也可以使用PHP内部函数或自定义函数来操纵字符串.
The class supports the extensions mbstring and iconv, and the package PHP-UTF8. It chooses the best available function for each method In addition, it provides many new methods. Some of them are: substringBetween, splice, startWith, endsWith and squeeze. It is also possible to use PHP internal functions, or custom functions, to manipulate the string.
示例代码:
<?php
include('string.php');
$str = new String('sometext');
echo $str->length; //prints 8
echo $str->getLength(); //prints 8
?>
我以前从未使用过此类,但是通过查看其文档,它具有一些非常有趣的方法.大写,charAt,compareTo,contains等.
I have never used this class before but by looking at its documentation it has some pretty interesting methods. capitalize, charAt, compareTo, contains, etc..