Skip to content

Commit

Permalink
Fix ucfirst behavior #6834
Browse files Browse the repository at this point in the history
  • Loading branch information
afbora committed Dec 10, 2024
1 parent 896c640 commit 7af14f9
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 7af14f9

Please sign in to comment.