本文整理汇总了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);
}