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

Arrays: added wrap() method #180

Merged
merged 2 commits into from Jan 11, 2021
Merged

Arrays: added wrap() method #180

merged 2 commits into from Jan 11, 2021

Conversation

milo
Copy link
Member

@milo milo commented Dec 7, 2018

  • new feature
  • BC break? no
  • doc PR: will

I'm using such conctruction quite often, maybe I'm not the only one.

milo pushed a commit to milo/nette-utils that referenced this pull request Dec 7, 2018
@milo
Copy link
Member Author

milo commented Dec 10, 2018

Maybe implement it by

count($arr) ? ($prefix . implode($suffix . $glue . $prefix, $arr) . $suffix) : '';

but crucial is an API. No need for array count condition and prefix/suffix on single place.

@dg
Copy link
Member

dg commented Oct 21, 2019

What about method wrap($arr, $prefix, $suffix)? And than combine implode with wrap?

@dg dg force-pushed the master branch 5 times, most recently from 740520b to 2bc2f58 Compare January 11, 2021 03:06
@milo
Copy link
Member Author

milo commented Jan 11, 2021

Sure, wrap() is better approach. Updated.

Not sure about type casting everything to string.

@dg
Copy link
Member

dg commented Jan 11, 2021

Great

@dg dg changed the title Arrays: added implode() method Arrays: added wrap() method Jan 11, 2021
@dg dg merged commit c698ad7 into nette:master Jan 11, 2021
dg pushed a commit that referenced this pull request Jan 11, 2021
@milo
Copy link
Member Author

milo commented Jan 11, 2021

Thank you!

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.

None yet

2 participants