Merge branch '3.1/release/3.1.4' into 3.1/master
[kohana-core.git] / utf8 / ltrim.php
blob2a81da9a08baed437d38dfdcb1d29cf8678d1769
1 <?php defined('SYSPATH') or die('No direct script access.');
2 /**
3 * UTF8::ltrim
5 * @package Kohana
6 * @author Kohana Team
7 * @copyright (c) 2007-2011 Kohana Team
8 * @copyright (c) 2005 Harry Fuecks
9 * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
11 function _ltrim($str, $charlist = NULL)
13 if ($charlist === NULL)
14 return ltrim($str);
16 if (UTF8::is_ascii($charlist))
17 return ltrim($str, $charlist);
19 $charlist = preg_replace('#[-\[\]:\\\\^/]#', '\\\\$0', $charlist);
21 return preg_replace('/^['.$charlist.']+/u', '', $str);