本文整理匯總了PHP中UTF8::ltrim方法的典型用法代碼示例。如果您正苦於以下問題:PHP UTF8::ltrim方法的具體用法?PHP UTF8::ltrim怎麽用?PHP UTF8::ltrim使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類UTF8
的用法示例。
在下文中一共展示了UTF8::ltrim方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _trim
/**
* UTF8::trim
*
* @package Kohana
* @author Kohana Team
* @copyright (c) 2007-2010 Kohana Team
* @copyright (c) 2005 Harry Fuecks
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
*/
function _trim($str, $charlist = NULL)
{
if ($charlist === NULL) {
return trim($str);
}
return UTF8::ltrim(UTF8::rtrim($str, $charlist), $charlist);
}
示例2: test_ltrim
/**
* Tests UTF8::ltrim
*
* @test
* @dataProvider provider_ltrim
*/
public function test_ltrim($input, $charlist, $expected)
{
$this->assertSame($expected, UTF8::ltrim($input, $charlist));
}
示例3: trim
/**
* Strips whitespace (or other UTF-8 characters) from the beginning and
* end of a string. This is a UTF8-aware version of [trim](http://php.net/trim).
*
* $str = UTF8::trim($str);
*
* @author Andreas Gohr <andi@splitbrain.org>
* @param string input string
* @param string string of characters to remove
* @return string
*/
public static function trim($str, $charlist = null)
{
if ($charlist === null) {
return trim($str);
}
return UTF8::ltrim(UTF8::rtrim($str, $charlist), $charlist);
}