Skip to content

[9.x] Add Str::lcfirst to support non-ascii characters (vs php's core lcfirst fct) and add DX consistency with ucfirst wrapper#41384

Merged
taylorotwell merged 2 commits intolaravel:9.xfrom
vpratfr:feature/9.x-str-lcfirst
Mar 7, 2022
Merged

[9.x] Add Str::lcfirst to support non-ascii characters (vs php's core lcfirst fct) and add DX consistency with ucfirst wrapper#41384
taylorotwell merged 2 commits intolaravel:9.xfrom
vpratfr:feature/9.x-str-lcfirst

Conversation

@vpratfr
Copy link
Copy Markdown
Contributor

@vpratfr vpratfr commented Mar 7, 2022

I needed in several projects a function to put the first character of a sentence as lower case (not the whole sentence).

Naturally I looked for it in the Str class as I know the ucfirst function lives there, but noticed it was missing.

I believe, by seeing the number of PRs to add this function to the framework, that many developers would enjoy this improvement to the DX. Getting consistency without having to macro the Str class in each of their projects.

So here is a non-breaking change to welcome the lcfirst function into the Str class.

It also works properly when lowercasing non ascii characters such as À or Ö, unlike the lcfirst function from code PHP.

@vpratfr vpratfr changed the title Add the lcfirst function to the Str class Add Str::lcfirst to support non-ascii characters (vs php's core lcfirst fct) and add DX consistency with ucfirst wrapper Mar 7, 2022
@vpratfr vpratfr changed the title Add Str::lcfirst to support non-ascii characters (vs php's core lcfirst fct) and add DX consistency with ucfirst wrapper [9.x] Add Str::lcfirst to support non-ascii characters (vs php's core lcfirst fct) and add DX consistency with ucfirst wrapper Mar 7, 2022
@taylorotwell taylorotwell merged commit 52b2b26 into laravel:9.x Mar 7, 2022
vpratfr added a commit to vpratfr/docs-1 that referenced this pull request Mar 7, 2022
taylorotwell pushed a commit to laravel/docs that referenced this pull request Mar 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants