-
Notifications
You must be signed in to change notification settings - Fork 11.2k
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
[10.x] Create fluent method convertCase #48492
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This function, convertCase, serves the purpose of converting the case of a given string while taking into account multibyte characters and character encoding. It offers flexibility by allowing you to specify the conversion mode and character encoding, with sensible defaults provided for ease of use. Here's a breakdown of its functionality: String: You provide a string as the input, which is the text you want to change the case of. Conversion Mode (Optional): The function allows you to specify the conversion mode through the $mode parameter. By default, it uses MB_CASE_FOLD, which converts the string to lowercase. However, you can change this mode according to your requirements. Character Encoding (Optional): You can also specify the character encoding through the $encoding parameter. The default encoding is 'UTF-8,' but you can set it to a different encoding if needed. If no encoding is provided, it will use the internal encoding. Output: The function returns the converted string with the specified case and encoding.
This doesn't look correct. It should return a new Stringable like the other methods (see |
@taylorotwell Sorry for the situation, I omitted to return a new static instance. |
timacdonald
pushed a commit
to timacdonald/framework
that referenced
this pull request
Sep 22, 2023
* Add method `Str::convertCase` This function, convertCase, serves the purpose of converting the case of a given string while taking into account multibyte characters and character encoding. It offers flexibility by allowing you to specify the conversion mode and character encoding, with sensible defaults provided for ease of use. Here's a breakdown of its functionality: String: You provide a string as the input, which is the text you want to change the case of. Conversion Mode (Optional): The function allows you to specify the conversion mode through the $mode parameter. By default, it uses MB_CASE_FOLD, which converts the string to lowercase. However, you can change this mode according to your requirements. Character Encoding (Optional): You can also specify the character encoding through the $encoding parameter. The default encoding is 'UTF-8,' but you can set it to a different encoding if needed. If no encoding is provided, it will use the internal encoding. Output: The function returns the converted string with the specified case and encoding. * Adjust StyleCI * formatting * [10.x] Create fluent method convertCase * [10.x] Return New Stringable --------- Co-authored-by: Taylor Otwell <taylor@laravel.com> Co-authored-by: rmunate <raulunatecastro@MacBook-Pro-de-Raul.local>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In a previous PR the
Str::convertCase
method was accepted and combined but I did not create the fluent method viaStr::of()
, the goal of this request is to add this method, I will be following the review of this request, later I will create the change request to the documentation, where I see that now the Strings will have their unique page. Thank you.