當前位置: 首頁>>代碼示例>>PHP>>正文


PHP UTF8::rtrim方法代碼示例

本文整理匯總了PHP中UTF8::rtrim方法的典型用法代碼示例。如果您正苦於以下問題:PHP UTF8::rtrim方法的具體用法?PHP UTF8::rtrim怎麽用?PHP UTF8::rtrim使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在UTF8的用法示例。


在下文中一共展示了UTF8::rtrim方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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);
}
開發者ID:azuya,項目名稱:Wi3,代碼行數:16,代碼來源:trim.php

示例2: test_rtrim

 /**
  * Tests UTF8::rtrim
  *
  * @test
  * @dataProvider provider_rtrim
  */
 public function test_rtrim($input, $input2, $expected)
 {
     $this->assertSame($expected, UTF8::rtrim($input, $input2));
 }
開發者ID:azuya,項目名稱:Wi3,代碼行數:10,代碼來源:UTF8Test.php

示例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);
 }
開發者ID:xiaodin1,項目名稱:myqee,代碼行數:18,代碼來源:utf8.class.php

示例4: 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::wptrim($str);
  *
  * @author  Andreas Gohr <andi@splitbrain.org>
  * @param   string  $str        input string
  * @param   string  $charlist   string of characters to remove
  * @return  string
  */
 public static function trim($str, $charlist = NULL)
 {
     if ($charlist === NULL) {
         return trim($str);
     }
     return UTF8::wpltrim(UTF8::rtrim($str, $charlist), $charlist);
 }
開發者ID:gnribeiro,項目名稱:turim,代碼行數:18,代碼來源:UTF8.php

示例5: word_limiter

 /**
  * Word Limiter, UTF-8 version.
  *
  * Limits a string to X number of words.
  *
  * @param       string
  * @param       int
  * @param       string    The end character. Usually an ellipsis
  * @return      string
  */
 function word_limiter($str, $limit = 100, $end_char = '&#8230;')
 {
     if (UTF8::trim($str) === '') {
         return $str;
     }
     // Added by Ivan Tcholakov, 08-FEB-2016.
     $end_char = html_entity_decode($end_char, ENT_QUOTES, 'UTF-8');
     //
     preg_match('/^\\s*+(?:\\S++\\s*+){1,' . (int) $limit . '}/' . (IS_UTF8_CHARSET && PCRE_UTF8_INSTALLED ? 'u' : ''), $str, $matches);
     if (UTF8::strlen($str) === UTF8::strlen($matches[0])) {
         $end_char = '';
     }
     return UTF8::rtrim($matches[0]) . $end_char;
 }
開發者ID:roniwahyu,項目名稱:starter-public-edition-3,代碼行數:24,代碼來源:MY_text_helper.php

示例6: word_limiter

 /**
  * Word Limiter, UTF-8 version.
  *
  * Limits a string to X number of words.
  *
  * @param       string
  * @param       int
  * @param       string    The end character. Usually an ellipsis
  * @return      string
  */
 function word_limiter($str, $limit = 100, $end_char = '&#8230;')
 {
     if (UTF8::trim($str) === '') {
         return $str;
     }
     preg_match('/^\\s*+(?:\\S++\\s*+){1,' . (int) $limit . '}/' . (IS_UTF8_CHARSET && PCRE_UTF8_INSTALLED ? 'u' : ''), $str, $matches);
     if (UTF8::strlen($str) === UTF8::strlen($matches[0])) {
         $end_char = '';
     }
     return UTF8::rtrim($matches[0]) . $end_char;
 }
開發者ID:Qnatz,項目名稱:starter-public-edition-4,代碼行數:21,代碼來源:MY_text_helper.php


注:本文中的UTF8::rtrim方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。