Example #1
0
 /**
  * Sorts the elements in an array of Unicode or ASCII strings, in the ascending order, case-insensitively, using
  * natural order comparison.
  *
  * To illustrate natural order with an example, an array with strings "a100", "a20", "a3" would be sorted into the
  * same array with `sortUStringsCi` method, but as "a3", "a20", "a100" with this method, which is the order a human
  * being would choose.
  *
  * @param  array $array The array to be sorted.
  * @param  bitfield $collationFlags **OPTIONAL. Default is** `CUString::COLLATION_DEFAULT`. The Unicode collation
  * option(s) to be used for string comparison. See the [CUString](CUString.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   CUString.html CUString
  */
 public static function sortUStringsNatCi($array, $collationFlags = CUString::COLLATION_DEFAULT, CULocale $inLocale = null)
 {
     assert('is_carray($array)', vs(isset($this), get_defined_vars()));
     $array = splarray($array);
     $locale = isset($inLocale) ? $inLocale->name() : CULocale::defaultLocaleName();
     $coll = CUString::collatorObject(true, true, $locale, $collationFlags);
     $pArray = self::toPArray($array);
     $res = $coll->sort($pArray);
     assert('$res', vs(isset($this), get_defined_vars()));
     self::assignArrayToMap($array, $pArray);
 }