You are here

public static function Unicode::strtolower in Service Container 7.2

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

Converts a UTF-8 string to lowercase.

Parameters

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

Return value

string The string in lowercase.

3 calls to Unicode::strtolower()
Html::getClass in lib/Drupal/Component/Utility/Html.php
Prepares a string for use as a valid class name.
Html::getId in lib/Drupal/Component/Utility/Html.php
Prepares a string for use as a valid HTML ID.
Unicode::lcfirst in lib/Drupal/Component/Utility/Unicode.php
Converts the first character of a UTF-8 string to lowercase.

File

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

Class

Unicode
Provides Unicode-related conversions and operations.

Namespace

Drupal\Component\Utility

Code

public static function strtolower($text) {
  if (static::getStatus() == static::STATUS_MULTIBYTE) {
    return mb_strtolower($text);
  }
  else {

    // Use C-locale for ASCII-only lowercase.
    $text = strtolower($text);

    // Case flip Latin-1 accented letters.
    $text = preg_replace_callback('/\\xC3[\\x80-\\x96\\x98-\\x9E]/', '\\Drupal\\Component\\Utility\\Unicode::caseFlip', $text);
    return $text;
  }
}