function Unicode::ucfirst

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

Capitalizes the first character of a UTF-8 string.

Parameters

string $text: The string to convert.

Return value

string The string with the first character as uppercase.

9 calls to Unicode::ucfirst()
DateTestBase::createField in core/modules/datetime/tests/src/Functional/DateTestBase.php
Creates a date test field.
DependencyTest::testMissingModules in core/modules/system/tests/src/Functional/Module/DependencyTest.php
Attempts to enable a module with a missing dependency.
drupal_verify_profile in core/includes/install.inc
Verifies that all dependencies are met for a given installation profile.
HandlerBase::caseTransform in core/modules/views/src/Plugin/views/HandlerBase.php
Transform a string by a certain method.
OverviewTerms::buildForm in core/modules/taxonomy/src/Form/OverviewTerms.php
Form constructor.

... See full list

File

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

Class

Unicode
Provides Unicode-related conversions and operations.

Namespace

Drupal\Component\Utility

Code

public static function ucfirst($text) {
    return mb_strtoupper(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.