本文整理汇总了PHP中utf8_ltrim函数的典型用法代码示例。如果您正苦于以下问题:PHP utf8_ltrim函数的具体用法?PHP utf8_ltrim怎么用?PHP utf8_ltrim使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了utf8_ltrim函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: utf8_trim
/**
* 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);
}
示例2: ltrim
/**
* UTF-8 aware replacement for ltrim()
*
* Strip whitespace (or other characters) from the beginning of a string
* 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
*
* @param string $str The string to be trimmed
* @param string $charlist The optional charlist of additional characters to trim
*
* @return string The trimmed string
*
* @see http://www.php.net/ltrim
* @since 11.1
*/
public static function ltrim($str, $charlist = false)
{
if (empty($charlist) && $charlist !== false) {
return $str;
}
jimport('phputf8.trim');
if ($charlist === false) {
return utf8_ltrim($str);
} else {
return utf8_ltrim($str, $charlist);
}
}
示例3: message
}
if (strlen($title) < 1) {
message($lang_common['Bad request']);
}
$close = isset($_POST['close']) ? intval($_POST['close']) : '2';
$stick = isset($_POST['stick']) ? intval($_POST['stick']) : '2';
$archive = isset($_POST['archive']) ? intval($_POST['archive']) : '2';
$move = isset($_POST['forum']) ? intval($_POST['forum']) : '0';
$leave_redirect = isset($_POST['redirect']) ? intval($_POST['redirect']) : '0';
$insert = array('title' => $title, 'close' => $close, 'stick' => $stick, 'archive' => $archive, 'move' => $move, 'leave_redirect' => $leave_redirect, 'reply_message' => $message, 'add_start' => $add_start, 'add_end' => $add_end, 'send_email' => $send_email, 'increment_posts' => $increment);
$db->insert('multi_moderation', $insert);
redirect(panther_link($panther_url['admin_moderate']), $lang_admin_moderate['added redirect']);
} elseif ($action == 'edit' && $id > '0') {
$message = isset($_POST['message']) ? panther_trim($_POST['message']) : null;
$title = isset($_POST['title']) ? panther_trim($_POST['title']) : null;
$add_start = isset($_POST['add_start']) ? utf8_ltrim($_POST['add_start']) : null;
$add_end = isset($_POST['add_end']) ? utf8_rtrim($_POST['add_end']) : null;
if (strlen($title) > 50) {
message($lang_admin_moderate['title too long']);
}
if (strlen($add_start) > 50 || strlen($add_end) > 50) {
message($lang_admin_moderate['addition too long']);
}
if (strlen($title) < 1) {
message($lang_common['Bad request']);
}
$close = isset($_POST['close']) ? intval($_POST['close']) : '2';
$stick = isset($_POST['stick']) ? intval($_POST['stick']) : '2';
$archive = isset($_POST['archive']) ? intval($_POST['archive']) : '2';
$move = isset($_POST['forum']) ? intval($_POST['forum']) : '0';
$leave_redirect = isset($_POST['redirect']) ? intval($_POST['redirect']) : '0';
示例4: ltrim
/**
* UTF-8 aware replacement for ltrim()
*
* Strip whitespace (or other characters) from the beginning of a string
* 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
*
* @param string $str The string to be trimmed
* @param string $charlist The optional charlist of additional characters to trim
*
* @return string The trimmed string
*
* @see http://www.php.net/ltrim
* @since 2.0
*/
public static function ltrim($str, $charlist = null)
{
if (empty($charlist) && $charlist !== null) {
return $str;
}
if (!function_exists('utf8_ltrim')) {
require_once __DIR__ . '/phputf8/trim.php';
}
if ($charlist === null) {
return utf8_ltrim($str);
}
return utf8_ltrim($str, $charlist);
}
示例5: ltrim
/**
* UTF-8 aware replacement for ltrim()
* Strip whitespace (or other characters) from the beginning of a string
* 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
*
* @static
* @access public
* @param string the string to be trimmed
* @param string the optional charlist of additional characters to trim
* @return string the trimmed string
* @see http://www.php.net/ltrim
*/
public static function ltrim($str, $charlist = FALSE)
{
jimport('phputf8.trim');
if ($charlist === FALSE) {
return utf8_ltrim($str);
} else {
return utf8_ltrim($str, $charlist);
}
}
示例6: utf8_trim
/**
* utf8_trim( )
*
* Strip whitespace or other characters from beginning or end of a UTF-8 string
* @since 1.3
*
* @param string $string The string to be trimmed
* @param string $chrs Optional characters to be stripped
* @return string The trimmed string
*/
function utf8_trim($string = '', $chrs = '')
{
$string = utf8_ltrim($string, $chrs);
return utf8_rtrim($string, $chrs);
}
示例7: ltrim
/**
* UTF-8 aware replacement for ltrim()
*
* Strip whitespace (or other characters) from the beginning of a string
* 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
*
* @param string $str The string to be trimmed
* @param string $charlist The optional charlist of additional characters to trim
*
* @return string The trimmed string
*
* @see http://www.php.net/ltrim
* @since 1.0
*/
public static function ltrim($str, $charlist = false)
{
if (empty($charlist) && $charlist !== false) {
return $str;
}
require_once __DIR__ . '/phputf8/trim.php';
if ($charlist === false) {
return utf8_ltrim($str);
}
return utf8_ltrim($str, $charlist);
}
示例8: utf8_trim
/**
* Unicode aware replacement for trim()
*
* @author Andreas Gohr <andi@splitbrain.org>
* @see trim()
* @return string
*/
function utf8_trim($str, $charlist = '')
{
if ($charlist == '') {
return trim($str);
}
return utf8_ltrim(utf8_rtrim($str));
}
示例9: ltrim
/**
* UTF-8 aware replacement for ltrim()
*
* Strip whitespace (or other characters) from the beginning of a string. 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.
*
* @param string $str The string to be trimmed
* @param string $charlist The optional charlist of additional characters to trim
*
* @return string The trimmed string
*
* @see http://www.php.net/ltrim
* @since 1.3.0
*/
public static function ltrim($str, $charlist = false)
{
if (empty($charlist) && $charlist !== false) {
return $str;
}
if ($charlist === false) {
return utf8_ltrim($str);
}
return utf8_ltrim($str, $charlist);
}
示例10: testLinefeedMask
function testLinefeedMask()
{
$str = "ñ\nñtërnâtiônàlizætiøn";
$trimmed = "tërnâtiônàlizætiøn";
$this->assertEqual(utf8_ltrim($str, "ñ\n"), $trimmed);
}
示例11: utf8_trim
/**
* UTF-8 aware replacement for trim().
*
* @author Andreas Gohr <andi@splitbrain.org>
* @see http://www.php.net/trim
* @see http://dev.splitbrain.org/view/darcs/dokuwiki/inc/utf8.php
* @param string $str
* @param boolean $charlist
* @return string
*/
function utf8_trim($str, $charlist = '')
{
if (empty($charlist)) {
return trim($str);
}
return utf8_ltrim(utf8_rtrim($str, $charlist), $charlist);
}
示例12: utf8_ltrim
function utf8_ltrim($str, $charlist = '')
{
return utf8_ltrim($str, $charlist);
}