示例#1
0
 /**
  * check if the literal address string has %nn appended
  * returns -1 if not, or the numeric value otherwise.
  *
  * %nn may also be a string that represents the displayName of
  * a currently available NetworkInterface.
  * @return int
  */
 private static function checkNumericZone(\blaze\lang\String $s)
 {
     $percent = $s->indexOf('%');
     $slen = $s->length();
     $digit = null;
     $zone = 0;
     if ($percent == -1) {
         return -1;
     }
     for ($i = $percent + 1; $i < $slen; $i++) {
         $c = $s->charAt($i);
         if ($c == ']') {
             if ($i == $percent + 1) {
                 /* empty per-cent field */
                 return -1;
             }
             break;
         }
         if (($digit = \baze\lang\Character::digit($c, 10)) < 0) {
             return -1;
         }
         $zone = $zone * 10 + $digit;
     }
     return $zone;
 }
示例#2
0
 private static function hashIgnoringCase($hash, \blaze\lang\String $s)
 {
     if ($s == null) {
         return $hash;
     }
     $h = $hash;
     $n = $s->length();
     for ($i = 0; $i < $n; $i++) {
         $h = 31 * $h + self::toLower($s->charAt($i));
     }
     return $h;
 }