當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。