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:com.antsdb.saltedfish.sql.vdm.FuncFindInSet.java
@Override public long eval(VdmContext ctx, Heap heap, Parameters params, long pRecord) { long pValue = this.parameters.get(0).eval(ctx, heap, params, pRecord); if (pValue == 0) { return 0; }//from ww w. j av a 2s . c om long pSet = this.parameters.get(1).eval(ctx, heap, params, pRecord); if (pSet == 0) { return 0; } int result = 0; String value = (String) FishObject.get(heap, AutoCaster.toString(heap, pValue)); String set = (String) FishObject.get(heap, AutoCaster.toString(heap, pSet)); String[] array = StringUtils.split(set, ','); for (int i = 0; i < array.length; i++) { if (value.equals(array[i])) { result = i + 1; } } return Int4.allocSet(heap, result); }
From source file:bazaar4idea.command.BzrHeadsCommand.java
public List<BzrRevisionNumber> execute(String branch) { ShellCommandService command = ShellCommandService.getInstance(project); BzrStandardResult result = command.execute2(repo, "heads", Arrays.asList("--template", "{rev}|{node|short}\\n", branch)); List<BzrRevisionNumber> heads = new ArrayList<BzrRevisionNumber>(); for (String line : result.getStdOutAsLines()) { try {/*from w w w . j a va 2s . c o m*/ String[] parts = StringUtils.split(line, '|'); heads.add(BzrRevisionNumber.getInstance(parts[0], parts[1])); } catch (NumberFormatException e) { LOG.warn("Unexpected head line '" + line + "'"); } } return heads; }
From source file:com.redhat.rhn.frontend.struts.ScrubbingDynaActionForm.java
/** * Tell the form to "scrub thyself"//from w w w . java 2s . c o m */ public void scrub() { List keys = new LinkedList(dynaValues.keySet()); Set<String> noScrub = new HashSet<String>(); Set<String> noParenScrub = new HashSet<String>(); if (dynaValues.containsKey(NO_SCRUB)) { for (String item : StringUtils.split((String) dynaValues.get(NO_SCRUB), ",")) { noScrub.add(item.trim()); } } if (dynaValues.containsKey(NO_PAREN_SCRUB)) { for (String item : StringUtils.split((String) dynaValues.get(NO_PAREN_SCRUB), ",")) { noParenScrub.add(item.trim()); } } for (Iterator iter = keys.iterator(); iter.hasNext();) { String name = (String) iter.next(); Object value = dynaValues.get(name); if (isScrubbable(name, value, noScrub)) { if (noParenScrub.contains(name)) { value = Scrubber.scrub(value, SPECIAL_PROHIBITED_INPUT); } else { value = Scrubber.scrub(value); } if (value == null) { dynaValues.remove(name); } else { dynaValues.put(name, value); } } } }
From source file:com.greenline.hrs.admin.cache.redis.util.RedisInfoParser.java
/** * infoString?map/*from w w w . j a v a 2 s. c o m*/ * * @param redisInfoStr * @return infoStrnullMap */ public static Map<String, String> infoMapParser(String redisInfoStr) { if (redisInfoStr == null || redisInfoStr.isEmpty()) { return Collections.emptyMap(); } String[] infoTokens = redisInfoStr.split(INFO_PROPERTY_DELIMITER); Map<String, String> infoMap = new HashMap<String, String>(infoTokens.length * 2); String[] propTokens = null; for (String infoToken : infoTokens) { propTokens = StringUtils.split(infoToken, INFO_PROPERTY_KY_DELIMITER); if (propTokens.length == PROPERTY_TOKENS_LEN) { infoMap.put(propTokens[PROP_KEY_IDX], propTokens[PROP_VALUE_IDX]); } } return infoMap; }
From source file:hudson.plugins.clearcase.model.Versions.java
public static Versions parse(String output, String viewPath, String separator) { Versions instance = new Versions(); for (String extendedViewPath : StringUtils.split(output, separator)) { instance.versions.add(Version.parse(extendedViewPath, viewPath)); }//from w w w. j a v a 2s.co m return instance; }
From source file:com.ansorgit.plugins.bash.editor.codecompletion.BashPathCommandCompletion.java
@Override public void initComponent() { String envPath = System.getenv("PATH"); if (envPath != null) { String[] split = StringUtils.split(envPath, ':'); if (split != null) { //fixme better do this in a background task? for (String path : Arrays.asList(split)) { File dir = new File(path); if (dir.exists() && dir.isDirectory()) { File[] commands = dir.listFiles(new ExecutableFileFilter()); if (commands != null) { for (File command : commands) { cachedCommands.add(command.getName()); }//from w ww . ja v a2 s . c om } } } } } }
From source file:com.haulmont.cuba.web.gui.components.WebPickerFieldActionHandler.java
public WebPickerFieldActionHandler(PickerField component) { this.component = component; Configuration configuration = AppBeans.get(Configuration.NAME); ClientConfig config = configuration.getConfig(ClientConfig.class); String[] strModifiers = StringUtils.split(config.getPickerShortcutModifiers().toUpperCase(), "-"); modifiers = new int[strModifiers.length]; for (int i = 0; i < modifiers.length; i++) { modifiers[i] = KeyCombination.Modifier.valueOf(strModifiers[i]).getCode(); }//from w w w. j a va2 s . c om }
From source file:net.kamhon.ieagle.struts2.jquery.datatables.DatatablesInterceptor.java
public String intercept(ActionInvocation actionInvocation) throws Exception { Map<String, Object> params = actionInvocation.getInvocationContext().getParameters(); if (actionInvocation.getAction() instanceof BaseDatatablesJsonAction<?>) { BaseDatatablesJsonAction<?> action = (BaseDatatablesJsonAction<?>) actionInvocation.getAction(); Object obj = params.get("sColumns"); if (obj != null) { String columns = ((String[]) obj)[0]; String ss[] = StringUtils.split(columns, ","); action.setGridColumns(ss);/* ww w. j av a 2s . c om*/ } } return actionInvocation.invoke(); }
From source file:com.mycompany.sonarqube.FooLanguage.java
/** * {@inheritDoc}/*from w w w .j a va 2s. c om*/ */ @Override public String[] getFileSuffixes() { String[] suffixes = filterEmptyStrings(settings.getStringArray(FILE_SUFFIXES_PROPERTY_KEY)); if (suffixes.length == 0) { suffixes = StringUtils.split(DEFAULT_FILE_SUFFIXES, ","); } return suffixes; }
From source file:com.netflix.explorers.context.RequestContext.java
public void setHttpServletRequest(HttpServletRequest requestInvoker) { this.requestInvoker = requestInvoker; if (requestInvoker != null) { String requestedWith = requestInvoker.getHeader("X-Requested-With"); isAjaxRequest = requestedWith != null && requestedWith.equalsIgnoreCase("XMLHttpRequest"); pathToRoot = this.getContextPath() + this.getServletPath(); if (!pathToRoot.endsWith("/")) { pathToRoot += "/"; }// ww w.jav a2s . co m String pathInfo = getPathInfo(); if (pathInfo != null) { String parts[] = StringUtils.split(pathInfo, "/"); explorerSubPath = pathInfo; if (parts.length > 0) { explorerName = parts[0]; explorerSubPath = pathInfo.substring(Math.min(pathInfo.length(), explorerName.length() + 2)); if (parts.length > 1) { currentMenu = parts[1]; } } } } }