DaveAKing / guava-libraries

Automatically exported from code.google.com/p/guava-libraries
Apache License 2.0
0 stars 0 forks source link

Decorate Joiner Outputs #463

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I think a new additional function to decorate the Joiner output will be useful.
Example :
    int[] arr= {1,2,3};
    Joiner.on(", ").decorate('(',')').join(Ints.asList(arr)));
Output:
(1,2,3)

Original issue reported on code.google.com by emilcha...@gmail.com on 30 Oct 2010 at 11:06

GoogleCodeExporter commented 9 years ago
"(" + Joiner.on(", ").join(Ints.asList(arr))) + ")";
will do the same and is shorter ;-)

but decoration may be seen as outputting "(1),(2),(3)" instead.

Which is more in adequacy with the logic of the join for me.

Original comment by amer...@gmail.com on 30 Oct 2010 at 12:37

GoogleCodeExporter commented 9 years ago
How about:

"(" + Joiner.on("},{").join(Ints.asList(arr))) + ")";

Original comment by fin...@gmail.com on 1 Nov 2010 at 3:05

GoogleCodeExporter commented 9 years ago
I'd like to keep Joiner focused on being a Joiner, not a JoinerAndSurrounder. 
:-)

Original comment by kevinb@google.com on 2 Nov 2010 at 6:28

GoogleCodeExporter commented 9 years ago
Issue 1758 has been merged into this issue.

Original comment by lowas...@google.com on 16 May 2014 at 7:01

GoogleCodeExporter commented 9 years ago
This issue has been migrated to GitHub.

It can be found at https://github.com/google/guava/issues/<id>

Original comment by cgdecker@google.com on 1 Nov 2014 at 4:15

GoogleCodeExporter commented 9 years ago

Original comment by cgdecker@google.com on 3 Nov 2014 at 9:09