• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

join list of strings

 
lajos kamocsay
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there an easy way to join a list of string in java using a delimiter?
For example:



I would like to make that into a path string, "/home/joe/tmp/". I can do:



But it seems there should be something in the API to do this ain one step. Python has:



Anything like that in Java?


Thanks.
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24208
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No.
 
Ken Blair
Ranch Hand
Posts: 1078
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, but you could write one fairly easily using varargs in 1.5:



Usage: join("/", "home", "joe", "tmp)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic