Example #1
0
 /**
  * This method does a comparison like that in $cmp(), except that it is case-insensitive.
  * @see strcmp()
  * @param Unicode_String $that
  * @return integer
  */
 function caseCmp($that)
 {
     $s1 = $this->toLower();
     $s2 = $that->toLower();
     return strcmp($s1->toUTF8(), $s2->toUTF8());
 }
Example #2
0
function utf8tolower($input_string)
{
    $ustring = new Unicode_String();
    $ustring->fromUTF8($input_string);
    return $ustring->toLower()->toUTF8();
}
Example #3
0
 /**
  * This method returns the lowercase representation of $string.
  *
  * This may be either a single Unicode_Character (eg E =gt; e)
  * or it may be a Unicode_String (eg ß =gt; ss).
  *
  * NB: This class does not implement toUpper() because to do so
  * requires knowledge of the string in which the character
  * appears.
  * @return Unicode_String|Unicode_Character
  */
 function toLower()
 {
     if (!isset($GLOBALS['Unicode_Character_CaseCache'][$this->ord()])) {
         $GLOBALS['Unicode_Character_CaseCache'][$this->ord()] = $this;
         require_once dirname(__FILE__) . '/String/CaseDB.php';
         foreach ($GLOBALS['Unicode_String_CaseDB'] as $row) {
             if ($row['upper'] == $this->ord()) {
                 if (count($row['lower']) > 1) {
                     require_once dirname(__FILE__) . '/String.php';
                     $lower = new Unicode_String();
                     foreach ($row['lower'] as $char) {
                         $lower->append(new Unicode_Character($char));
                     }
                 } else {
                     $lower = new Unicode_Character($row['lower'][0]);
                 }
                 $GLOBALS['Unicode_Character_CaseCache'][$this->ord()] = $lower;
                 break;
             }
         }
     }
     return $GLOBALS['Unicode_Character_CaseCache'][$this->ord()];
 }