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


PHP utf8_strcspn函數代碼示例

本文整理匯總了PHP中utf8_strcspn函數的典型用法代碼示例。如果您正苦於以下問題:PHP utf8_strcspn函數的具體用法?PHP utf8_strcspn怎麽用?PHP utf8_strcspn使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了utf8_strcspn函數的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: strcspn

 /**
  * UTF-8 aware alternative to strcspn
  * Find length of initial segment not matching mask
  *
  * @param   string   $str     The string to process
  * @param   string   $mask    The mask
  * @param   integer  $start   Optional starting character position (in characters)
  * @param   integer  $length  Optional length
  *
  * @return  integer  The length of the initial segment of str1 which does not contain any of the characters in str2
  *
  * @see     http://www.php.net/strcspn
  * @since   11.1
  */
 public static function strcspn($str, $mask, $start = null, $length = null)
 {
     jimport('phputf8.strcspn');
     if ($start === false && $length === false) {
         return utf8_strcspn($str, $mask);
     } elseif ($length === false) {
         return utf8_strcspn($str, $mask, $start);
     } else {
         return utf8_strcspn($str, $mask, $start, $length);
     }
 }
開發者ID:nogsus,項目名稱:joomla-platform,代碼行數:25,代碼來源:string.php

示例2: strcspn

 /**
  * UTF-8 aware alternative to strcspn
  * Find length of initial segment not matching mask
  *
  * @static
  * @access public
  * @param string
  * @param string the mask
  * @param int Optional starting character position (in characters)
  * @param int Optional length
  * @return int the length of the initial segment of str1 which does not contain any of the characters in str2
  * @see http://www.php.net/strcspn
  */
 public static function strcspn($str, $mask, $start = NULL, $length = NULL)
 {
     jimport('phputf8.strcspn');
     if ($start === FALSE && $length === FALSE) {
         return utf8_strcspn($str, $mask);
     } else {
         if ($length === FALSE) {
             return utf8_strcspn($str, $mask, $start);
         } else {
             return utf8_strcspn($str, $mask, $start, $length);
         }
     }
 }
開發者ID:joebushi,項目名稱:joomla,代碼行數:26,代碼來源:string.php

示例3: strcspn

 /**
  * UTF-8 aware alternative to strcspn
  * Find length of initial segment not matching mask
  *
  * @param   string   $str     The string to process
  * @param   string   $mask    The mask
  * @param   integer  $start   Optional starting character position (in characters)
  * @param   integer  $length  Optional length
  *
  * @return  integer  The length of the initial segment of str1 which does not contain any of the characters in str2
  *
  * @see     http://www.php.net/strcspn
  * @since   2.0
  */
 public static function strcspn($str, $mask, $start = null, $length = null)
 {
     if (!function_exists('utf8_strcspn')) {
         require_once __DIR__ . '/phputf8/strcspn.php';
     }
     if ($start === null && $length === null) {
         return utf8_strcspn($str, $mask);
     }
     if ($length === null) {
         return utf8_strcspn($str, $mask, $start);
     }
     return utf8_strcspn($str, $mask, $start, $length);
 }
開發者ID:lyrasoft,項目名稱:lyrasoft.github.io,代碼行數:27,代碼來源:Utf8String.php

示例4: testLinefeedMask

 function testLinefeedMask()
 {
     $str = "i\nñtërnâtiônàlizætiøn";
     $this->assertEqual(utf8_strcspn($str, "\n"), 1);
 }
開發者ID:kidwellj,項目名稱:scuttle,代碼行數:5,代碼來源:utf8_strcspn.test.php

示例5: strcspn

 /**
  * UTF-8 aware alternative to strcspn
  * Find length of initial segment not matching mask
  *
  * @param   string   $str     The string to process
  * @param   string   $mask    The mask
  * @param   integer  $start   Optional starting character position (in characters)
  * @param   integer  $length  Optional length
  *
  * @return  integer  The length of the initial segment of str1 which does not contain any of the characters in str2
  *
  * @see     http://www.php.net/strcspn
  * @since   1.0
  */
 public static function strcspn($str, $mask, $start = null, $length = null)
 {
     require_once __DIR__ . '/phputf8/strcspn.php';
     if ($start === false && $length === false) {
         return utf8_strcspn($str, $mask);
     }
     if ($length === false) {
         return utf8_strcspn($str, $mask, $start);
     }
     return utf8_strcspn($str, $mask, $start, $length);
 }
開發者ID:jasonrgd,項目名稱:Digital-Publishing-Platform-Joomla,代碼行數:25,代碼來源:String.php

示例6: strcspn

 /**
  * UTF-8 aware alternative to strcspn()
  *
  * Find length of initial segment not matching mask.
  *
  * @param   string   $str     The string to process
  * @param   string   $mask    The mask
  * @param   integer  $start   Optional starting character position (in characters)
  * @param   integer  $length  Optional length
  *
  * @return  integer  The length of the initial segment of str1 which does not contain any of the characters in str2
  *
  * @see     http://www.php.net/strcspn
  * @since   1.3.0
  */
 public static function strcspn($str, $mask, $start = null, $length = null)
 {
     if ($start === false && $length === false) {
         return utf8_strcspn($str, $mask);
     }
     if ($length === false) {
         return utf8_strcspn($str, $mask, $start);
     }
     return utf8_strcspn($str, $mask, $start, $length);
 }
開發者ID:lyrasoft,項目名稱:lyrasoft.github.io,代碼行數:25,代碼來源:StringHelper.php


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