Skip to content

Commit

Permalink
Merge pull request #6860 from getkirby/fix/6834-ucfirst-behavior
Browse files Browse the repository at this point in the history
Fix `ucfirst` behavior
  • Loading branch information
bastianallgeier authored Dec 10, 2024
2 parents 720fa68 + 7af14f9 commit cde80bd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Toolkit/Str.php
Original file line number Diff line number Diff line change
Expand Up @@ -1405,7 +1405,7 @@ public static function ucfirst(string|null $string): string
{
$first = static::substr($string, 0, 1);
$rest = static::substr($string, 1);
return static::upper($first) . static::lower($rest);
return static::upper($first) . $rest;
}

/**
Expand Down
5 changes: 4 additions & 1 deletion tests/Toolkit/StrTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1492,7 +1492,10 @@ public function testTrim()
public function testUcfirst()
{
$this->assertSame('Hello world', Str::ucfirst('hello world'));
$this->assertSame('Hello world', Str::ucfirst('Hello World'));
$this->assertSame('Hello world', Str::ucfirst('Hello world'));
$this->assertSame('Hello World', Str::ucfirst('Hello World'));
$this->assertSame('HELLO WORLD', Str::ucfirst('HELLO WORLD'));
$this->assertSame('Hello WORLD', Str::ucfirst('hello WORLD'));
}

/**
Expand Down

0 comments on commit cde80bd

Please sign in to comment.