-
Notifications
You must be signed in to change notification settings - Fork 314
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
Add join(prefix, sep, suffix) -> String
#981
Comments
So this:
...would be a shorthand for this:
|
I‘m pretty sure that - if we do this - we should aim for interleave_with_prefix_separator_suffix, ie. not tie it to strings. Users then can still call join manually if they want. I know it may be a bit annoying if prefix/separator/suffix have different types, but the concept seems not inherently related to text. |
So
...would be a shorthand for:
That's quite a mouthful, and I think the argument for providing a shorthand for that is a bit stronger. Then again, I cannot think of a time where I've needed such a pattern outside of string formatting, and this shorthand works poorly for string formatting when the item type isn't a string. |
This makes me think of this conversation about |
Add a
join()
operator withprefix
,sep
andsuffix
.assert_eq!([1, 2, 3].iter().join("<[", ", ", "]>"), "<[1, 2, 3]>");
The text was updated successfully, but these errors were encountered: