Skip to content
New issue

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

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

Already on GitHub? # to your account

feat(support): add wrap and unwrap to StringHelper #693

Merged
merged 1 commit into from
Nov 6, 2024

Conversation

innocenzi
Copy link
Member

This pull request adds support for wrap and unwrap on StringHelper.

str('value')->wrap('[', ']'); // [value]
str('[value]')->unwrap('[', ']'); // value

Unwrapping will only work if both ends correspond to the given before and after arguments. The strict argument disables this behavior:

str('Scott Kennedy')->unwrap('Leon ', ' Kennedy', strict: true); // Scott Kennedy
str('Scott Kennedy')->unwrap('Leon ', ' Kennedy', strict: false); // Scott

@innocenzi innocenzi force-pushed the feat/string-helper/wrap branch from 431d6ae to 0de489a Compare November 6, 2024 15:24
@brendt brendt merged commit a0fffe9 into tempestphp:main Nov 6, 2024
57 checks passed
@innocenzi innocenzi deleted the feat/string-helper/wrap branch November 6, 2024 20:04
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants