function Unicode::lcfirst

Same name in other branches
  1. 8.9.x core/lib/Drupal/Component/Utility/Unicode.php \Drupal\Component\Utility\Unicode::lcfirst()
  2. 10 core/lib/Drupal/Component/Utility/Unicode.php \Drupal\Component\Utility\Unicode::lcfirst()
  3. 11.x core/lib/Drupal/Component/Utility/Unicode.php \Drupal\Component\Utility\Unicode::lcfirst()

Converts the first character of a UTF-8 string to lowercase.

Parameters

string $text: The string that will be converted.

Return value

string The string with the first character as lowercase.

Related topics

1 call to Unicode::lcfirst()
UnicodeTest::testLcfirst in core/tests/Drupal/Tests/Component/Utility/UnicodeTest.php
Tests multibyte lcfirst.

File

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

Class

Unicode
Provides Unicode-related conversions and operations.

Namespace

Drupal\Component\Utility

Code

public static function lcfirst($text) {
    // Note: no mbstring equivalent!
    return mb_strtolower(mb_substr($text, 0, 1)) . mb_substr($text, 1);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.