1 unicode.inc backdrop_strtoupper($text)

Uppercase a UTF-8 string.

Parameters

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

Return value

string: The string in uppercase.

Related topics

File

core/includes/unicode.inc, line 508
Provides Unicode-related conversions and operations.

Code

function backdrop_strtoupper($text) {
  // Bail early if $text is NULL.
  // @todo Remove this in 2.x.
  if (is_null($text)) {
    return "";
  }

  global $multibyte;
  if ($multibyte == UNICODE_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]/', '_unicode_caseflip', $text);
    return $text;
  }
}