예제 #1
0
 /**
  * This method returns a new Unicode_String object that represents $string with all its characters converted to lower case.
  *
  * Note that for some languages converting to lowercase may
  * change the length of the string.
  *
  * The database that contains this information is quite large
  * and is stored in a separate file (Unicode/String/CaseDB.php)
  * that is only loaded when required.
  * @return Unicode_String
  */
 function toLower()
 {
     $lower = new Unicode_String();
     foreach ($this->chars() as $char) {
         $lower->append($char->toLower());
     }
     return $lower;
 }
예제 #2
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()];
 }