Skip to content

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 dg force-pushed the master branch 7 times, most recently from 1d615d6 to ec1e405 Compare February 5, 2019 21:43
@dg dg force-pushed the master branch 10 times, most recently from 5c076fd to 0b71017 Compare March 17, 2019 13:59
@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 2 times, most recently from 3ad8f46 to c133e18 Compare October 21, 2019 20:42
@dg dg force-pushed the master branch 5 times, most recently from 4ed28bc to 7331c07 Compare November 19, 2019 21:02
@dg dg force-pushed the master branch 6 times, most recently from 2255a73 to 7a754e0 Compare November 4, 2020 12:10
@dg dg force-pushed the master branch 2 times, most recently from 1113bc3 to 7a71315 Compare November 5, 2020 23:55
@dg dg force-pushed the master branch 5 times, most recently from f3d5f78 to d0427c1 Compare November 25, 2020 23:48
@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.

2 participants