<?php
/**
* @version $Id$
* @package utf8
* @subpackage strings
*/
//---------------------------------------------------------------
/**
* UTF-8 aware replacement for ltrim()
* Note: you only need to use this if you are supplying the charlist
* optional arg and it contains UTF-8 characters. Otherwise ltrim will
* work normally on a UTF-8 string
* @author Andreas Gohr <andi@splitbrain.org>
* @see http://www.php.net/ltrim
* @see http://dev.splitbrain.org/view/darcs/dokuwiki/inc/utf8.php
* @return string
* @package utf8
* @subpackage strings
*/
function utf8_ltrim( $str, $charlist = FALSE ) {
if($charlist === FALSE) return ltrim($str);
//quote charlist for use in a characterclass
$charlist = preg_replace('!([\\\\\\-\\]\\[/^])!','\\\${1}',$charlist);
return preg_replace('/^['.$charlist.']+/u','',$str);
}
//---------------------------------------------------------------
/**
* UTF-8 aware replacement for rtrim()
* Note: you only need to use this if you are supplying the charlist
* optional arg and it contains UTF-8 characters. Otherwise rtrim will
* work normally on a UTF-8 string
* @author Andreas Gohr <andi@splitbrain.org>
* @see http://www.php.net/rtrim
* @see http://dev.splitbrain.org/view/darcs/dokuwiki/inc/utf8.php
* @return string
* @package utf8
* @subpackage strings
*/
function utf8_rtrim( $str, $charlist = FALSE ) {
if($charlist === FALSE) return rtrim($str);
//quote charlist for use in a characterclass
$charlist = preg_replace('!([\\\\\\-\\]\\[/^])!','\\\${1}',$charlist);
return preg_replace('/['.$charlist.']+$/u','',$str);
}
//---------------------------------------------------------------
/**
* UTF-8 aware replacement for trim()
* 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
* @author Andreas Gohr <andi@splitbrain.org>
* @see http://www.php.net/trim
* @see http://dev.splitbrain.org/view/darcs/dokuwiki/inc/utf8.php
* @return string
* @package utf8
* @subpackage strings
*/
function utf8_trim( $str, $charlist = FALSE ) {
if($charlist === FALSE) return trim($str);
return utf8_ltrim(utf8_rtrim($str, $charlist), $charlist);
}| nama | waktu | ukuran | owner | perm | aksi |
|---|---|---|---|---|---|
| .. | |||||
| mbstring/ | 2014-04-14 19:58 | 4.13 KB | 76129f60960:kunden | dxwrx-rx-r | |
| native/ | 2014-04-14 19:58 | 16.63 KB | 76129f60960:kunden | dxwrx-rx-r | |
| utils/ | 2014-04-14 19:58 | 52.66 KB | 76129f60960:kunden | dxwrx-rx-r | |
| LICENSE | 2014-04-14 19:52 | 25.81 KB | 76129f60960:kunden | -xw-x----- | |
| README | 2014-04-14 19:52 | 3.29 KB | 76129f60960:kunden | -xw-x----- | |
| index.html | 2014-04-14 19:52 | 31 B | 76129f60960:kunden | -xw-x----- | |
| ord.php | 2014-04-14 19:52 | 2.35 KB | 76129f60960:kunden | -xw-x----- | |
| str_ireplace.php | 2014-04-14 19:52 | 1.95 KB | 76129f60960:kunden | -xw-x----- | |
| str_pad.php | 2014-04-14 19:52 | 1.67 KB | 76129f60960:kunden | -xw-x----- | |
| str_split.php | 2014-04-14 19:52 | 824 B | 76129f60960:kunden | -xw-x----- | |
| strcasecmp.php | 2014-04-14 19:52 | 546 B | 76129f60960:kunden | -xw-x----- | |
| strcspn.php | 2014-04-14 19:52 | 894 B | 76129f60960:kunden | -xw-x----- | |
| stristr.php | 2014-04-14 19:52 | 855 B | 76129f60960:kunden | -xw-x----- | |
| strrev.php | 2014-04-14 19:52 | 458 B | 76129f60960:kunden | -xw-x----- | |
| strspn.php | 2014-04-14 19:52 | 923 B | 76129f60960:kunden | -xw-x----- | |
| substr_replace.php | 2014-04-14 19:52 | 600 B | 76129f60960:kunden | -xw-x----- | |
| trim.php | 2014-04-14 19:52 | 2.18 KB | 76129f60960:kunden | -xw-x----- | |
| ucfirst.php | 2014-04-14 19:52 | 787 B | 76129f60960:kunden | -xw-x----- | |
| ucwords.php | 2014-04-14 19:52 | 1.44 KB | 76129f60960:kunden | -xw-x----- | |
| utf8.php | 2014-04-14 19:52 | 2.22 KB | 76129f60960:kunden | -xw-x----- | |