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


PHP String::asNative方法代码示例

本文整理汇总了PHP中String::asNative方法的典型用法代码示例。如果您正苦于以下问题:PHP String::asNative方法的具体用法?PHP String::asNative怎么用?PHP String::asNative使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在String的用法示例。


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

示例1: __construct

 /**
  * Creates a new instance of a throwable object.
  *
  * @param blaze\lang\String|string $message The error message.
  * @param blaze\lang\Integer|int $code The error code.
  * @param blaze\lang\Throwable $previous The th
  */
 public function __construct($message = null, $code = null, $previous = null)
 {
     parent::__construct(String::asNative($message), Integer::asNative($code), $previous);
     if ($previous != null && !$previous instanceof Throwable) {
         new IllegalArgumentException('Previous element must be a subtype of Throwable', 0, $this);
     }
 }
开发者ID:robo47,项目名称:BlazeFramework,代码行数:14,代码来源:Throwable.php

示例2: getStringHash

 public static function getStringHash($value)
 {
     $value = String::asNative($value);
     if (!array_key_exists($value, self::$hashes)) {
         $h = 0;
         $off = 0;
         $val = $value;
         $len = strlen($value);
         for ($i = 0; $i < $len; $i++) {
             $h = 31 * $h + $val[$off++];
         }
         self::$hashes[$value] = $h;
     }
     return self::$hashes[$value];
 }
开发者ID:robo47,项目名称:BlazeFramework,代码行数:15,代码来源:HashUtil.php

示例3: get

 protected function get($identifier)
 {
     if (!is_array($this->actRow)) {
         throw new DataSourceException('No valid result.');
     }
     if (is_int($identifier)) {
         if (!array_key_exists($identifier, $this->actRowIndex)) {
             throw new DataSourceException('Index ' . $identifier . ' was not found.');
         }
         return $this->actRowIndex[$identifier];
     } else {
         if (!array_key_exists(String::asNative($identifier), $this->actRow)) {
             throw new DataSourceException('Index ' . $identifier . ' was not found.');
         }
         return $this->actRow[String::asNative($identifier)];
     }
 }
开发者ID:robo47,项目名称:BlazeFramework,代码行数:17,代码来源:AbstractCallableStatement.php

示例4: asNative

 /**
  *
  * @param mixed $value
  * @return char
  */
 public static function asNative($value)
 {
     if ($value instanceof Character) {
         return $value->value;
     }
     $value = String::asNative($value);
     if (is_string($value) && strlen($value) != 0) {
         return $value[0];
     }
     return '';
 }
开发者ID:robo47,项目名称:BlazeFramework,代码行数:16,代码来源:Character.php

示例5: asNative

 /**
  *
  * @param blaze\lang\Boolean|boolean $value
  * @return boolean
  */
 public static function asNative($value)
 {
     if ($value instanceof Boolean) {
         return $value->value;
     } else {
         if (is_bool($value)) {
             return $value;
         } else {
             return (bool) String::asNative($value);
         }
     }
 }
开发者ID:robo47,项目名称:BlazeFramework,代码行数:17,代码来源:Boolean.php

示例6: __toString

 /**
  * @access private
  * @return string
  */
 public final function __toString()
 {
     return String::asNative($this->toString());
 }
开发者ID:robo47,项目名称:BlazeFramework,代码行数:8,代码来源:Object.php

示例7: splitRegex

 /**
  * Splits this string around matches of the given <a
  * href="../util/regex/Pattern.html#sum">regular expression</a>.
  *
  * <p> This method works as if by invoking the two-argument {@link
  * #split(String, int) split} method with the given expression and a limit
  * argument of zero.  Trailing empty strings are therefore not included in
  * the resulting array.
  *
  * <p> The string <tt>"boo:and:foo"</tt>, for example, yields the following
  * results with these expressions:
  *
  * <blockquote><table cellpadding=1 cellspacing=0 summary="Split examples showing regex and result">
  * <tr>
  *  <th>Regex</th>
  *  <th>Result</th>
  * </tr>
  * <tr><td align=center>:</td>
  *     <td><tt>{ "boo", "and", "foo" }</tt></td></tr>
  * <tr><td align=center>o</td>
  *     <td><tt>{ "b", "", ":and:f" }</tt></td></tr>
  * </table></blockquote>
  *
  *
  * @param  regex
  *         the delimiting regular expression
  *
  * @return array[blaze\lang\String] the array of strings computed by splitting this string
  *          around matches of the given regular expression
  *
  * @throws  PatternSyntaxException
  *          if the regular expression's syntax is invalid
  *
  * @see java.util.regex.Pattern
  *
  * @since 1.4
  * @spec JSR-51
  */
 public function splitRegex($regex, $limit = null, $wrapper = false)
 {
     $regex = String::asNative($regex);
     if (!$wrapper) {
         return preg_split($regex, $this->string, $limit);
     }
     $pieces = preg_split($regex, $this->string, $limit);
     $result = array();
     foreach ($pieces as $piece) {
         $result[] = new String($piece);
     }
     return $result;
 }
开发者ID:robo47,项目名称:BlazeFramework,代码行数:51,代码来源:String.php

示例8: setProperty

 public static function setProperty($key, $value)
 {
     $key = String::asNative($key);
     $oldValue = self::getProperty($key);
     self::$props->setProperty($key, $value);
     return $oldValue;
 }
开发者ID:robo47,项目名称:BlazeFramework,代码行数:7,代码来源:Runtime.php


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