当前位置: 首页>>代码示例>>PHP>>正文


PHP _strcspn函数代码示例

本文整理汇总了PHP中_strcspn函数的典型用法代码示例。如果您正苦于以下问题:PHP _strcspn函数的具体用法?PHP _strcspn怎么用?PHP _strcspn使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了_strcspn函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: pdf_read_token

 /**
  * Reads a token from the file
  *
  * @param object $c pdf_context
  *
  * @return mixed
  */
 function pdf_read_token(&$c)
 {
     // If there is a token available
     // on the stack, pop it out and
     // return it.
     if (count($c->stack)) {
         return array_pop($c->stack);
     }
     // Strip away any whitespace
     do {
         if (!$c->ensure_content()) {
             return false;
         }
         $c->offset += _strspn($c->buffer, " \n\r\t", $c->offset);
     } while ($c->offset >= $c->length - 1);
     // Get the first character in the stream
     $char = $c->buffer[$c->offset++];
     switch ($char) {
         case '[':
         case ']':
         case '(':
         case ')':
             // This is either an array or literal string
             // delimiter, Return it
             return $char;
         case '<':
         case '>':
             // This could either be a hex string or
             // dictionary delimiter. Determine the
             // appropriate case and return the token
             if ($c->buffer[$c->offset] == $char) {
                 if (!$c->ensure_content()) {
                     return false;
                 }
                 $c->offset++;
                 return $char . $char;
             } else {
                 return $char;
             }
         default:
             // This is "another" type of token (probably
             // a dictionary entry or a numeric value)
             // Find the end and return it.
             if (!$c->ensure_content()) {
                 return false;
             }
             while (1) {
                 // Determine the length of the token
                 $pos = _strcspn($c->buffer, " []<>()\r\n\t/", $c->offset);
                 if ($c->offset + $pos <= $c->length - 1) {
                     break;
                 } else {
                     // If the script reaches this point,
                     // the token may span beyond the end
                     // of the current buffer. Therefore,
                     // we increase the size of the buffer
                     // and try again--just to be safe.
                     $c->increase_length();
                 }
             }
             $result = substr($c->buffer, $c->offset - 1, $pos + 1);
             $c->offset += $pos;
             return $result;
     }
 }
开发者ID:BozzaCoon,项目名称:SPHERE-Framework,代码行数:72,代码来源:pdf_parser.php

示例2: strcspn

 /**
  * Finds the length of the initial segment not matching mask.
  * @see http://php.net/strcspn
  *
  * @author  Harry Fuecks <hfuecks@gmail.com>
  *
  * @param   string   input string
  * @param   string   mask for search
  * @param   integer  start position of the string to examine
  * @param   integer  length of the string to examine
  * @return  integer  length of the initial segment that contains characters not in the mask
  */
 public static function strcspn($str, $mask, $offset = NULL, $length = NULL)
 {
     if (!isset(self::$called[__FUNCTION__])) {
         require SYSPATH . 'core/utf8/' . __FUNCTION__ . EXT;
         // Function has been called
         self::$called[__FUNCTION__] = TRUE;
     }
     return _strcspn($str, $mask, $offset, $length);
 }
开发者ID:momoim,项目名称:momo-api,代码行数:21,代码来源:utf8.php

示例3: strcspn

 public static function strcspn($str, $mask, $offset = NULL, $length = NULL)
 {
     if (!isset(UTF8::$called[__FUNCTION__])) {
         require JsonApiApplication::find_file("utf8", __FUNCTION__);
         // Function has been called
         UTF8::$called[__FUNCTION__] = TRUE;
     }
     return _strcspn($str, $mask, $offset, $length);
 }
开发者ID:benshez,项目名称:DreamWeddingCeremonies,代码行数:9,代码来源:UTF8.php

示例4: strcspn

 /**
  * Finds the length of the initial segment not matching mask.
  * @see http://php.net/strcspn
  *
  * @author  Harry Fuecks <hfuecks@gmail.com>
  *
  * @param   string   input string
  * @param   string   mask for search
  * @param   integer  start position of the string to examine
  * @param   integer  length of the string to examine
  * @return  integer  length of the initial segment that contains characters not in the mask
  */
 public static function strcspn($str, $mask, $offset = NULL, $length = NULL)
 {
     require_once dirname(__FILE__) . '/' . __FUNCTION__ . '.php';
     return _strcspn($str, $mask, $offset, $length);
 }
开发者ID:abhinay100,项目名称:forma_app,代码行数:17,代码来源:lib.utf8.php

示例5: strcspn

 /**
  * Finds the length of the initial segment not matching mask
  *
  * This is a UTF8-aware version of [strcspn](http://php.net/strcspn).
  *
  * Example:
  * ~~~
  * $found = UTF8::strcspn($str, $mask);
  * ~~~
  *
  * @author  Harry Fuecks <hfuecks@gmail.com>
  *
  * @param   string   $str     Input string
  * @param   string   $mask    Mask for search
  * @param   integer  $offset  Start position of the string to examine [Optional]
  * @param   integer  $length  Length of the string to examine [Optional]
  *
  * @return  integer
  *
  * @uses    Kohana::find_file
  */
 public static function strcspn($str, $mask, $offset = NULL, $length = NULL)
 {
     UTF8::_load(__FUNCTION__);
     return _strcspn($str, $mask, $offset, $length);
 }
开发者ID:ultimateprogramer,项目名称:cms,代码行数:26,代码来源:utf8.php

示例6: strcspn

 /**
  * Finds the length of the initial segment not matching mask. This is a
  * UTF8-aware version of [strcspn](http://php.net/strcspn).
  *
  *     $found = UTF8::strcspn($str, $mask);
  *
  * @author  Harry Fuecks <hfuecks@gmail.com>
  * @param   string  $str    input string
  * @param   string  $mask   mask for search
  * @param   integer $offset start position of the string to examine
  * @param   integer $length length of the string to examine
  * @return  integer length of the initial segment that contains characters not in the mask
  */
 public static function strcspn($str, $mask, $offset = null, $length = null)
 {
     if (!isset(UTF8::$called[__FUNCTION__])) {
         require Phalcana::$di->get('fs')->findFile('utf8', __FUNCTION__);
         // Function has been called
         UTF8::$called[__FUNCTION__] = true;
     }
     return _strcspn($str, $mask, $offset, $length);
 }
开发者ID:braf,项目名称:phalcana-core,代码行数:22,代码来源:UTF8.php

示例7: strcspn

 /**
  * Finds the length of the initial segment not matching mask. This is a
  * UTF8-aware version of [strcspn](http://php.net/strcspn).
  *
  *     $found = UTF8::strcspn($str, $mask);
  *
  * @author  Harry Fuecks <hfuecks@gmail.com>
  * @param   string  $str    input string
  * @param   string  $mask   mask for search
  * @param   integer $offset start position of the string to examine
  * @param   integer $length length of the string to examine
  * @return  integer length of the initial segment that contains characters not in the mask
  */
 public static function strcspn($str, $mask, $offset = NULL, $length = NULL)
 {
     if (!isset(self::$called[__FUNCTION__])) {
         require Kohana::find_file('utf8', __FUNCTION__);
         // Function has been called
         self::$called[__FUNCTION__] = TRUE;
     }
     return _strcspn($str, $mask, $offset, $length);
 }
开发者ID:BenjaminRomeo,项目名称:KohanaTest,代码行数:22,代码来源:UTF8.php


注:本文中的_strcspn函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。