List of usage examples for org.apache.commons.lang StringUtils join
public static String join(Collection<?> collection, String separator)
Joins the elements of the provided Collection
into a single String containing the provided elements.
From source file:de.codesourcery.luaparser.Item.java
@Override public String toString() { return "\"" + name + "\" requires " + StringUtils.join(requirements, " , "); }
From source file:edu.harvard.iq.dvn.ingest.dsb.impl.DvnDSButil.java
/** * /* ww w.ja v a2s . c om*/ * * @param * @return */ public static String joinNelementsPerLine(String[] vn, int divisor, String sp, boolean quote, String qm, String lnsp) { if (!(divisor >= 1)) { divisor = 1; } else if (divisor > vn.length) { divisor = vn.length; } String sep = null; if (sp != null) { sep = sp; } else { sep = ", "; } String qmrk = null; if (quote) { if (qm == null) { qmrk = ","; } else { if (qm.equals("\"")) { qmrk = "\""; } else { qmrk = qm; } } } else { qmrk = ""; } String lineSep = null; if (lnsp == null) { lineSep = "\n"; } else { lineSep = lnsp; } String vnl = null; if (vn.length < divisor) { vnl = StringUtils.join(vn, sep); } else { StringBuilder sb = new StringBuilder(); int iter = vn.length / divisor; int lastN = vn.length % divisor; if (lastN != 0) { iter++; } int iterm = iter - 1; for (int i = 0; i < iter; i++) { int terminalN = divisor; if ((i == iterm) && (lastN != 0)) { terminalN = lastN; } for (int j = 0; j < terminalN; j++) { if ((divisor * i + j + 1) == vn.length) { sb.append(qmrk + vn[j + i * divisor] + qmrk); } else { sb.append(qmrk + vn[j + i * divisor] + qmrk + sep); } } if (i < (iter - 1)) { sb.append(lineSep); } } vnl = sb.toString(); dbgLog.fine("results:\n" + vnl); } return vnl; }
From source file:fitnesseMain.ant.StartFitnesseTask.java
@Override public void execute() throws BuildException { Java java = new Java(); java.setProject(getProject());/*from w w w . j a v a2 s . c o m*/ java.setOwningTarget(getOwningTarget()); java.setFailonerror(true); java.setClassname("fitnesseMain.FitNesseMain"); java.setClasspathRef(getClasspathRef()); String[] argv = { "-p", String.valueOf(getFitnessePort()), "-d", getWikiDirectoryRootPath(), "-e", "0", "-o" }; java.setArgs(StringUtils.join(argv, " ")); super.execute(); }
From source file:dk.frankbille.scoreboard.domain.TeamResult.java
public TeamResult(TeamId team, Set<Player> players) { this.team = team; List<String> names = new ArrayList<String>(); for (Player player : players) { names.add(player.getName());/*ww w .ja v a2 s . c om*/ } Collections.sort(names); this.name = StringUtils.join(names, ", "); }
From source file:com.hd.stringcalculator.StringCalculator.java
public int add(String numbers) throws NegativeNumberException { if (numbers == null) { throw new NullPointerException(); } else if (numbers.isEmpty()) { return 0; }//from w w w .ja v a2 s.c om if (!numbers.matches( "-?[0-9]+((" + Pattern.quote(separator) + ")-?[0-9]+)*(" + Pattern.quote(separator) + ")?")) { throw new IllegalArgumentException("Bad character(s) in input string: " + numbers); } List<String> numbersList = Arrays .asList(numbers.split("(?<!" + Pattern.quote(separator) + ")" + Pattern.quote(separator))); List<String> negativeNumbers = new StringListFilter("[-][0-9]+").filter(numbersList); if (negativeNumbers.size() > 0) { throw new NegativeNumberException(StringUtils.join(negativeNumbers.iterator(), ", ")); } int sum = 0; for (String stringNumber : numbersList) { sum += Integer.valueOf(stringNumber); } return sum; }
From source file:com.fengduo.bee.search.utils.PinyinParser.java
public static String converterToFirstSpell(String chines) { return StringUtils.join(converter2FirstSpell(chines), ","); }
From source file:edu.scripps.fl.pubchem.app.relations.ELinkStage.java
@Override public void preprocess() throws StageException { try {//w ww . jav a 2 s . c o m Set<String> dbs = EUtilsWebSession.getInstance().getDatabases(); dbs.remove("pccompound"); dbs.remove("pcsubstance"); databases = StringUtils.join(dbs, ","); } catch (Exception ex) { throw new StageException(this, ex); } }
From source file:com.github.hexocraft.chestpreview.command.CpCommandCreate.java
/** * @param plugin The plugin that this object belong to. *//*from ww w . j a v a 2 s . co m*/ public CpCommandCreate(ChestPreviewPlugin plugin) { super("create", plugin); this.setAliases(Lists.newArrayList("c", "enable", "e")); this.setDescription(StringUtils.join(plugin.messages.cCreate, "\n")); this.setPermission(Permissions.ADMIN.toString()); }
From source file:com.pinterest.secor.parser.PartitionedMessageParser.java
@Override public String[] extractPartitions(Message message) throws Exception { String[] dailyPartition = generatePartitions(new Date().getTime(), mUsingHourly, mUsingMinutely); String dailyPartitionPath = StringUtils.join(dailyPartition, '/'); String[] result = { dailyPartitionPath }; return result; }
From source file:de.tudarmstadt.ukp.dkpro.core.io.brat.internal.model.BratLabelDecl.java
@Override public String toString() { return type + " | " + StringUtils.join(labels, " | "); }