You are here

public static function Unicode::strtoupper in Service Container 7

Same name and namespace in other branches
  1. 7.2 lib/Drupal/Component/Utility/Unicode.php \Drupal\Component\Utility\Unicode::strtoupper()

Converts a UTF-8 string to uppercase.

Parameters

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

Return value

string The string in uppercase.

3 calls to Unicode::strtoupper()
Unicode::strcasecmp in lib/Drupal/Component/Utility/Unicode.php
Compares UTF-8-encoded strings in a binary safe case-insensitive manner.
Unicode::ucfirst in lib/Drupal/Component/Utility/Unicode.php
Capitalizes the first character of a UTF-8 string.
Unicode::ucwords in lib/Drupal/Component/Utility/Unicode.php
Capitalizes the first character of each word in a UTF-8 string.

File

lib/Drupal/Component/Utility/Unicode.php, line 307
Contains \Drupal\Component\Utility\Unicode.

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;
  }
}