Javadoc for String shows that String.split() is what you are looking for in relation to explode .
Java does not include the "implode" equivalent of "join". Instead of including a giant external dependency for a simple function, as other answers suggest, you can simply write a couple lines of code. There are several ways to do this; using StringBuilder is one:
String foo = "This,that,other"; String[] split = foo.split(","); StringBuilder sb = new StringBuilder(); for (int i = 0; i < split.length; i++) { sb.append(split[i]); if (i != split.length - 1) { sb.append(" "); } } String joined = sb.toString();
Brian Roach May 27 '13 at 1:23 pm 2013-05-27 13:23
source share