Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[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
merged 2 commits into from
Mar 7, 2022

Conversation

vpratfr
Copy link
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