List of usage examples for org.apache.commons.lang StringUtils split
public static String[] split(String str, String separatorChars)
Splits the provided text into an array, separators specified.
From source file:hudson.plugins.clearcase.model.Version.java
public String getElement() { return StringUtils.split(path, '@')[0]; }
From source file:com.adobe.acs.commons.workflow.bulk.removal.impl.WorkflowInstanceFolderComparator.java
/** * Compares resource names that are in the format YYYY-MM-DD_N where _N is an optional positive integer. * * Sorts in an ascending order.// w ww . j av a 2s . com * * @param workflowFolder1 workflow folder 1 * @param workflowFolder2 workflow folder 2 * @return sort descending */ @Override public final int compare(final Resource workflowFolder1, final Resource workflowFolder2) { final String[] segments1 = StringUtils.split(workflowFolder1.getName(), "-_"); final String[] segments2 = StringUtils.split(workflowFolder2.getName(), "-_"); int result = 0; for (int i = 0; i < MAX_SEGMENTS; i++) { String seg1 = "-1"; String seg2 = "-1"; if (i < segments1.length) { seg1 = segments1[i]; } if (i < segments2.length) { seg2 = segments2[i]; } result = this.compare(seg1, seg2); if (result != 0) { return result; } } return result; }
From source file:com.hangum.tadpole.engine.restful.RESTfulAPIUtils.java
/** * make argument to map/* w w w. j av a2s . c om*/ * @param strArgument * @return * @throws UnsupportedEncodingException */ public static Map<String, String> maekArgumentTOMap(String strArgument) throws RESTFULUnsupportedEncodingException { if (StringUtils.split(strArgument, "&") == null) return new HashMap<String, String>(); if (logger.isDebugEnabled()) logger.debug("original URL is ===> " + strArgument); Map<String, String> params = new HashMap<String, String>(); try { for (String param : StringUtils.split(strArgument, "&")) { String pair[] = StringUtils.split(param, "="); String key = URLDecoder.decode(pair[0], "UTF-8"); String value = ""; if (pair.length > 1) { try { value = URLDecoder.decode(pair[1], "UTF-8"); } catch (Exception e) { value = pair[1]; } } params.put(key, value); } } catch (UnsupportedEncodingException e1) { throw new RESTFULUnsupportedEncodingException(e1); } return params; }
From source file:com.safetys.framework.jmesa.view.html.toolbar.MaxRowsItemRenderer.java
public String render() { MaxRowsItem item = getToolbarItem(); if (item.getIncrements().length == 0) { String increments[] = StringUtils .split(getCoreContext().getPreference(TOOLBAR_MAX_ROWS_DROPLIST_INCREMENTS), ","); int[] values = new int[increments.length]; for (int i = 0; i < increments.length; i++) { values[i] = Integer.valueOf(increments[i]); }/* www. jav a 2 s . co m*/ item.setIncrements(values); } Limit limit = getCoreContext().getLimit(); int maxRows = limit.getRowSelect().getMaxRows(); item.setMaxRows(maxRows); if (!incrementsContainsMaxRows(item, maxRows)) { throw new IllegalStateException("The maxRowIncrements does not contain the maxRows."); } StringBuilder action = new StringBuilder("jQuery.jmesa.setMaxRowsToLimit('" + limit.getId() + "', this.options[this.selectedIndex].value);" + getOnInvokeActionJavaScript(limit, item)); item.setAction(action.toString()); return getCoreContext().getMessage("html.toolbar.text.pagesize") + item.enabled(); }
From source file:fr.wati.yacramanager.config.apidoc.SwaggerConfiguration.java
/** * Swagger Spring MVC configuration/*from w ww. jav a2 s. co m*/ */ @Bean public SwaggerSpringMvcPlugin swaggerSpringMvcPlugin(SpringSwaggerConfig springSwaggerConfig) { return new SwaggerSpringMvcPlugin(springSwaggerConfig).apiInfo(apiInfo()) .genericModelSubstitutes(ResponseEntity.class).includePatterns(StringUtils .split(propertyResolver.getProperty("includePatterns", DEFAULT_INCLUDE_PATTERN), ",")); }
From source file:com.dianping.phoenix.dev.core.tools.generator.stable.GitRepositoryListGenerator.java
private static List<ProjectRepositoryPair> parsePage(int pageNo) throws Exception { String page = curl(REPO_BASEURL + "/public/projects?page=" + pageNo); List<ProjectRepositoryPair> pairs = null; if (StringUtils.isNotBlank(page)) { String[] lines = StringUtils.split(page, "\n"); for (String line : lines) { if (StringUtils.isNotBlank(line)) { int pos = line.indexOf(PATTERN_PRE); if (pos >= 0) { pairs = pairs == null ? new ArrayList<ProjectRepositoryPair>() : pairs; String repoUrl = line.substring(pos + PATTERN_PRE.length() - REPO_BASEURL.length(), line.length() - PATTERN_SUF.length()); String projectName = repoUrl.substring(repoUrl.lastIndexOf("/") + 1, repoUrl.length() - PATTERN_GIT.length()); if (hasPom(repoUrl) || repoUrl.startsWith("http://code.dianpingoa.com/arch/phoenix-maven-config.git")) { pairs.add(new ProjectRepositoryPair(projectName, repoUrl)); }//from w w w.ja v a2s . co m } } } } return pairs; }
From source file:hudson.plugins.clearcase.model.Versions.java
public static Versions parse(Reader reader, String viewPath, String separator) throws IOException { Versions instance = new Versions(); BufferedReader br = new BufferedReader(reader); String line;// w w w . ja va 2s .com while ((line = br.readLine()) != null) { for (String extendedViewPath : StringUtils.split(line, separator)) { instance.versions.add(Version.parse(extendedViewPath, viewPath)); } } return instance; }
From source file:com.novartis.pcs.ontology.rest.servlet.MIMEParse.java
/** * Carves up a mime-type and returns a ParseResults object * /* w ww . j a v a 2 s.c o m*/ * For example, the media range 'application/xhtml;q=0.5' would get parsed * into: * * ('application', 'xhtml', {'q', '0.5'}) */ protected static ParseResults parseMimeType(String mimeType) { String[] parts = StringUtils.split(mimeType, ";"); ParseResults results = new ParseResults(); results.params = new HashMap<String, String>(); for (int i = 1; i < parts.length; ++i) { String p = parts[i]; String[] subParts = StringUtils.split(p, '='); if (subParts.length == 2) results.params.put(subParts[0].trim(), subParts[1].trim()); } String fullType = parts[0].trim(); // Java URLConnection class sends an Accept header that includes a // single "*" - Turn it into a legal wildcard. if (fullType.equals("*")) fullType = "*/*"; String[] types = StringUtils.split(fullType, "/"); results.type = types[0].trim(); results.subType = types[1].trim(); return results; }
From source file:ml.shifu.shifu.core.binning.obj.NumBinInfo.java
public static List<NumBinInfo> constructNumBinfo(String binsData, char fieldSeparator) { List<NumBinInfo> binInfos = new ArrayList<NumBinInfo>(); List<Double> thresholds = new ArrayList<Double>(); thresholds.add(Double.NEGATIVE_INFINITY); if (StringUtils.isNotBlank(binsData)) { String[] fields = StringUtils.split(binsData, fieldSeparator); if (fields != null) { for (String field : fields) { Double val = null; try { val = Double.valueOf(field); thresholds.add(val); } catch (Exception e) { // skip illegal double }//ww w . j a va 2 s .c om } } } thresholds.add(Double.POSITIVE_INFINITY); Collections.sort(thresholds); for (int i = 0; i < thresholds.size() - 1; i++) { binInfos.add(new NumBinInfo(thresholds.get(i), thresholds.get(i + 1))); } return binInfos; }
From source file:com.intel.cosbench.driver.iterator.RangeIterator.java
private static RangeIterator tryParseOld(String pattern) { String[] args = StringUtils.split(pattern, '-'); int lower = Integer.parseInt(args[0]); int upper = Integer.parseInt(args[1]); return new RangeIterator(lower, upper); }