Ejemplo n.º 1
0
 public function testSortUStringsCi()
 {
     $array = CArray::fromElements("c", "B", "d", "E", "D", "C", "a", "e", "b", "A");
     CArray::sortUStringsCi($array, CUString::COLLATION_DEFAULT);
     $this->assertTrue(CArray::equals($array, CArray::fromElements("a", "A", "B", "b", "C", "c", "D", "d", "E", "e")));
     $array = CArray::fromElements("č", "B", "d", "E", "D", "C", "á", "ê", "b", "A");
     CArray::sortUStringsCi($array, CUString::COLLATION_IGNORE_ACCENTS);
     $this->assertTrue(CArray::equals($array, CArray::fromElements("á", "A", "B", "b", "C", "č", "D", "d", "E", "ê")));
     $array = CArray::fromElements(" c", ",B", ".d", ":E", ";D", "!C", "?a", "\"e", "(b", "[A");
     CArray::sortUStringsCi($array, CUString::COLLATION_IGNORE_NONWORD);
     $this->assertTrue(CArray::equals($array, CArray::fromElements("?a", "[A", ",B", "(b", "!C", " c", ";D", ".d", ":E", "\"e")));
     $array = CArray::fromElements("c", "B", "d", "E", "D", "C", "a", "e", "b", "A");
     CArray::sortUStringsCi($array, CUString::COLLATION_UPPERCASE_FIRST);
     $this->assertTrue(CArray::equals($array, CArray::fromElements("a", "A", "B", "b", "C", "c", "D", "d", "E", "e")));
 }
Ejemplo n.º 2
0
 /**
  * Sorts the elements in an array of Unicode or ASCII strings, in the ascending order, case-insensitively.
  *
  * @param  bitfield $collationFlags **OPTIONAL. Default is** `CUStringObject::COLLATION_DEFAULT`. The Unicode
  * collation option(s) to be used for string comparison. See the [CUStringObject](CUStringObject.html) class for
  * information on collation options.
  * @param  CULocale $inLocale **OPTIONAL. Default is** *the application's default locale*. The locale in which
  * strings are to be compared with each other.
  *
  * @return void
  *
  * @link   CUStringObject.html CUStringObject
  */
 public function sortUStringsCi($collationFlags = CUStringObject::COLLATION_DEFAULT, CULocale $inLocale = null)
 {
     CArray::sortUStringsCi($this->m_splArray, $collationFlags, $inLocale);
 }