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:dk.dma.ais.analysis.viewer.rest.VesselListFilter.java
public VesselListFilter(QueryParams request) { for (String filterName : filterNames) { if (request.containsKey(filterName)) { HashSet<String> values = new HashSet<String>(); String[] arr = StringUtils.split(request.getFirst(filterName), ","); for (String value : arr) { values.add(value);/* ww w . j a v a 2 s.com*/ } if (values.size() > 0) { filterMap.put(filterName, values); } } } }
From source file:com.alibaba.otter.shared.arbitrate.model.RemedyIndexEventData.java
public static RemedyIndexEventData parseNodeName(String node) { String[] datas = StringUtils.split(node, SPLIT); if (datas.length != 3) { throw new ArbitrateException("remedy index[" + node + "] format is not correctly!"); }/*from w ww. ja va 2 s. c o m*/ RemedyIndexEventData eventData = new RemedyIndexEventData(); eventData.setProcessId(Long.valueOf(datas[0])); eventData.setStartTime(Long.valueOf(datas[1])); eventData.setEndTime(Long.valueOf(datas[2])); return eventData; }
From source file:net.erdfelt.android.sdkfido.sdks.Version.java
public Version(String ver) { String parts[] = StringUtils.split(ver, "."); if (parts.length > 3) { throw new IllegalArgumentException( "Invalid version identifier string [" + ver + "] it can only have max 3 parts"); }//from w w w.ja v a2 s . c o m this.major = Integer.parseInt(parts[0]); if (parts.length > 1) { this.minor = Integer.parseInt(parts[1]); if (parts.length > 2) { this.point = Integer.parseInt(parts[2]); } } }
From source file:de.elatexam.editor.components.panels.tasks.mapping.CorrectAssignementConverter.java
public Object convertToObject(final String value, final Locale locale) { final List<String> result = new ArrayList<String>(); for (final String s : StringUtils.split(value, ',')) { result.add(s);//from w w w . j a va 2s. c o m } return result; }
From source file:net.sf.zekr.engine.root.QuranRoot.java
/** * Parse the raw root text db.//from ww w .j ava2 s. c om * * @param rawRootText */ private void parse(String rawRootText) { String[] rootLines = StringUtils.split(rawRootText, '\n'); for (int i = 0; i < ROOT_LIST_SIZE; i++) { String[] rootBody = StringUtils.split(rootLines[i], '\t'); String rootStr = rootBody[0]; String rootAddrStr; // rootrootBody[1] is frequency, not really needed! rootAddrStr = rootBody[2]; rootList.add(rootStr); String[] addrList = StringUtils.split(rootAddrStr, ";"); // aya separator List<RootAddress> rootAddrList = new ArrayList<RootAddress>(); RootAddress ra = null; for (int j = 0; j < addrList.length; j++) { String[] locStr = StringUtils.split(addrList[j], ':'); String[] wordIndex = StringUtils.split(locStr[1], ','); int absoluteAya = Integer.parseInt(locStr[0]); IQuranLocation loc = QuranPropertiesUtils.getLocation(absoluteAya + 1); try { for (int k = 0; k < wordIndex.length; k++) { ra = new RootAddress(loc, Integer.parseInt(wordIndex[k].replace("\r", ""))); rootAddrList.add(ra); } } catch (Exception e) { e.printStackTrace(); } // TODO: load it for next release. // if (reverseIndex[absoluteAya] == null) { // reverseIndex[absoluteAya] = new ListOrderedMap(); // } // reverseIndex[absoluteAya].put(new Integer(wordIndex), rootStr); } rootAddr.put(rootStr, rootAddrList); } }
From source file:cn.vlabs.duckling.vwb.tags.CheckRequestContextTag.java
public void setContext(String arg) { m_context = arg; m_contextList = StringUtils.split(arg, '|'); }
From source file:co.cask.cdap.gateway.router.DatasetsProxyRule.java
@Override public HttpRequest apply(HttpRequest request) { String path = URI.create(request.getUri()).normalize().getPath(); String[] uriParts = StringUtils.split(path, '/'); if ((uriParts.length >= 4) && uriParts[1].equals("data") && uriParts[2].equals("datasets")) { // three parts with '/' wrapping them int insertAt = uriParts[0].length() + uriParts[1].length() + uriParts[2].length() + 4; String datasetName = uriParts[3]; request.setUri(processDatasetPath(path, insertAt, datasetName)); } else if ((uriParts.length == 6) && uriParts[1].equals("data") && uriParts[2].equals("explore") && uriParts[3].equals("datasets") && uriParts[5].equals("schema")) { // four parts with '/' wrapping them int insertAt = uriParts[0].length() + uriParts[1].length() + uriParts[2].length() + uriParts[3].length() + 5;/*from w ww . j a v a 2 s .c om*/ String datasetName = uriParts[4]; request.setUri(processDatasetPath(path, insertAt, datasetName)); } return request; }
From source file:com.ewcms.web.pubsub.ProgressSender.java
private Integer getSiteId(String path) { String[] s = StringUtils.split(path, "/"); String value = s[s.length - 1]; try {/*w ww . ja v a 2 s .co m*/ return Integer.valueOf(value); } catch (Exception e) { return Integer.MIN_VALUE; } }
From source file:com.htmlhifive.tools.codeassist.core.proposal.checker.CheckerUtils.java
/** * ?????????.//from w w w . ja v a 2 s.c o m * * @param codeAssistStr ?. * @return ?? */ public static String getRootObject(String codeAssistStr) { String[] codeAssistStrParts = StringUtils.split(codeAssistStr, "."); // ?????. String beforePart = null; for (String part : codeAssistStrParts) { if (KEY_PATTERN.matcher(part).matches() || beforePart == null) { beforePart = part; continue; } return beforePart; } return beforePart; }
From source file:com.netflix.simianarmy.basic.janitor.BasicVolumeTaggingMonkeyContext.java
/** * The constructor./*w ww . j a v a 2s. c o m*/ */ public BasicVolumeTaggingMonkeyContext() { super("simianarmy.properties", "client.properties", "volumeTagging.properties"); for (String r : StringUtils.split(region(), ",")) { createClient(r); awsClients.add(awsClient()); } }