public static function Unicode::strtoupper

public static Unicode::strtoupper($text)

Converts a UTF-8 string to uppercase.

Parameters

string $text: The string to run the operation on.

Return value

string The string in uppercase.

File

core/lib/Drupal/Component/Utility/Unicode.php, line 302

Class

Unicode
Provides Unicode-related conversions and operations.

Namespace

Drupal\Component\Utility

Code

public static function strtoupper($text) {
  if (static::getStatus() == static::STATUS_MULTIBYTE) {
    return mb_strtoupper($text);
  }
  else {
    // Use C-locale for ASCII-only uppercase.
    $text = strtoupper($text);
    // Case flip Latin-1 accented letters.
    $text = preg_replace_callback('/\xC3[\xA0-\xB6\xB8-\xBE]/', '\Drupal\Component\Utility\Unicode::caseFlip', $text);
    return $text;
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Component!Utility!Unicode.php/function/Unicode::strtoupper/8.1.x