Ejemplo n.º 1
0
 /**
  * Returns <tt>true</tt> if and only if this <tt>String</tt> represents
  * the same sequence of characters as the specified <tt>StringBuffer</tt>.
  *
  * @param   sb         the <tt>StringBuffer</tt> to compare to.
  * @return  <tt>true</tt> if and only if this <tt>String</tt> represents
  *          the same sequence of characters as the specified
  *          <tt>StringBuffer</tt>, otherwise <tt>false</tt>.
  * @since 1.4
  */
 public function contentEquals(StringBuffer $sb)
 {
     if ($this->count != $sb->length()) {
         return false;
     }
     $v1 = $this->value;
     $v2 = $sb->getValue();
     $i = $offset;
     $j = 0;
     $n = $count;
     while ($n-- != 0) {
         if ($v1[$i++] != $v2[$j++]) {
             return false;
         }
     }
     return true;
 }