Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
General String useful stuff.
 
 package ch.cern.mig.utils;
 
 import java.util.List;

Useful String utility.

Author(s):
Massimo Paladin - massimo.paladin@gmail.com
Copyright CERN 2010-2013
public class StringUtils {
	public StringUtils () {
	}
	public static String join(Object[] arguments) {
		return join(Arrays.asList(arguments));
	}
	public static String join(Object[] argumentsString glue) {
		return join(Arrays.asList(arguments), glue);
	}
	public static String join(List<Objectarguments) {
		return join(arguments", ");
	}
	public static String join(List<ObjectargumentsString glue) {
		if (arguments == null) {
			return "";
		}
		StringBuilder output = new StringBuilder();
		Iterator<Objectit = arguments.iterator();
		while (it.hasNext()) {
			output.append(it.next().toString());
			if (it.hasNext()) {
				output.append(glue);
			}
		}
		return output.toString();
	}
New to GrepCode? Check out our FAQ X