List of usage examples for org.apache.commons.lang3 StringUtils split
public static String[] split(final String str, final String separatorChars)
Splits the provided text into an array, separators specified.
From source file:edu.wustl.mir.erl.ihe.xdsi.util.RelatedGeneralSOPClasses.java
public void init(Properties props) { for (String cuid : props.stringPropertyNames()) commonExtNegs.put(cuid, new CommonExtendedNegotiation(cuid, UID.StorageServiceClass, StringUtils.split(props.getProperty(cuid), ','))); }
From source file:com.paladin.mvc.URLMappingFilter.java
@Override public void init(FilterConfig cfg) throws ServletException { this.context = cfg.getServletContext(); // ? // w w w . j a v a 2s. c om this.PATH_PREFIX = cfg.getInitParameter("template-path-prefix"); if (this.PATH_PREFIX == null) this.PATH_PREFIX = "/WEB-INF/templates"; else if (this.PATH_PREFIX.endsWith("/")) this.PATH_PREFIX = this.PATH_PREFIX.substring(0, this.PATH_PREFIX.length() - 1); // ? URL ??? /img/*** String ignores = cfg.getInitParameter("ignore"); if (ignores != null) for (String ig : StringUtils.split(ignores, ',')) ignoreURIs.add(ig.trim()); // ? URL ?? ? ? *.jpg ignores = cfg.getInitParameter("ignoreExts"); if (ignores != null) for (String ig : StringUtils.split(ignores, ',')) ignoreExts.add('.' + ig.trim()); // ?? String tmp = cfg.getInitParameter("domain"); if (StringUtils.isNotBlank(tmp)) rootDomain = tmp; // ?? ? ? @SuppressWarnings("unchecked") Enumeration<String> names = cfg.getInitParameterNames(); while (names.hasMoreElements()) { String name = names.nextElement(); String v = cfg.getInitParameter(name); if (v.endsWith("/")) v = v.substring(0, v.length() - 1); if ("ignore".equalsIgnoreCase(name) || "ignoreExts".equalsIgnoreCase(name)) continue; if ("default".equalsIgnoreCase(name)) default_base = PATH_PREFIX + v; else other_base.put(name, PATH_PREFIX + v); } }
From source file:com.mirth.connect.plugins.datatypes.edi.EDIXMLHandler.java
public void startElement(String uri, String name, String qName, Attributes atts) { if (sawHeader == false) { segmentDelimiter = atts.getValue("segmentDelimiter"); elementDelimiter = atts.getValue("elementDelimiter"); subelementDelimiter = atts.getValue("subelementDelimiter"); if (segmentDelimiter == null) { segmentDelimiter = "~"; }//from w w w . j ava 2s .c o m if (elementDelimiter == null) { elementDelimiter = "*"; } if (subelementDelimiter == null) { subelementDelimiter = ":"; } sawHeader = true; } else { if (currentLocation.equals(Location.DOCUMENT)) { output.append(name); currentLocation = Location.SEGMENT; lastInSubelement = false; previousSegmentNameArray = null; } else if (currentLocation.equals(Location.SEGMENT)) { String[] currentNameArray = StringUtils.split(name, "."); int currentDelimeterCount = currentNameArray.length - 1; if (currentDelimeterCount == 1) { int previousId = 0; if (previousSegmentNameArray != null) { previousId = NumberUtils.toInt(previousSegmentNameArray[1]); } int currentId = NumberUtils.toInt(currentNameArray[1]); for (int i = 1; i < (currentId - previousId); i++) { output.append(elementDelimiter); } previousSegmentNameArray = currentNameArray; } output.append(elementDelimiter); currentLocation = Location.ELEMENT; lastInSubelement = false; previousElementNameArray = null; } else if (currentLocation.equals(Location.ELEMENT)) { String[] currentNameArray = StringUtils.split(name, "."); int currentDelimeterCount = currentNameArray.length - 1; if (currentDelimeterCount == 2) { int previousId = 0; if (previousElementNameArray != null) { previousId = NumberUtils.toInt(previousElementNameArray[2]); } int currentId = NumberUtils.toInt(currentNameArray[2]); for (int i = 1; i < (currentId - previousId); i++) { output.append(subelementDelimiter); } previousElementNameArray = currentNameArray; } if (lastInSubelement) { output.append(subelementDelimiter); } currentLocation = Location.SUBELEMENT; lastInSubelement = true; } } }
From source file:de.micromata.tpsb.doc.parser.JavaDocUtil.java
/** * Extrahiert Titel und Beschreibung aus dem JavaDoc Kommentar * /*from w w w .j a v a2 s . c o m*/ * @param cleanedContent bereinigter Content * @return Tupel Titel,Beschreibung */ private static Pair<String, String> extractTitleAndDescription(String cleanedContent) { String[] lines = StringUtils.split(cleanedContent, LINE_FEED); if (lines == null) { return new Pair<String, String>(); } List<String> titleAndDesc = new ArrayList<String>(); for (String line : lines) { String trimmedLine = line.trim(); if (trimmedLine.startsWith("@") == true) { break; } titleAndDesc.add(trimmedLine); } Pair<String, String> ret = new Pair<String, String>(); boolean titleFinished = false; StringBuilder sb = new StringBuilder(); for (int i = 0; i < titleAndDesc.size(); i++) { String s = titleAndDesc.get(i); if (StringUtils.isBlank(s) == true) { if (sb.length() == 0) { continue; } if (titleFinished == false) { ret.setFirst(sb.toString()); titleFinished = true; sb = new StringBuilder(); continue; } if (sb.length() > 0) { sb.append(s); } } else { if (sb.length() > 0) { sb.append("\n"); } sb.append(s); } } if (sb.length() > 0) { if (titleFinished == false) { ret.setFirst(sb.toString()); } else { ret.setSecond(sb.toString()); } } return ret; }
From source file:com.anrisoftware.globalpom.math.MathUtils.java
/** * Returns the number of decimal places from the specified number string. * /*w w w . j av a2 s .com*/ * @param str * the {@link String} of the number. * * @param decimalSeparator * the decimal separator character. * * @return the number of decimal places. * * @see DecimalFormatSymbols#getDecimalSeparator() * * @since 2.1 */ public static int decimalPlaces(String str, char decimalSeparator, String exponentSeparator) { String[] split = StringUtils.split(str, exponentSeparator); double exponent = 0.0; int decimal = 0; if (split.length == 2) { exponent = Double.valueOf(split[1]); } String valuestr = split[0]; int i = valuestr.indexOf(decimalSeparator); if (i != -1) { decimal = valuestr.substring(i).length() - 1; } decimal += -1.0 * exponent; return FastMath.abs(decimal); }
From source file:com.eurodisney.streamit.solr.product.ProductServiceImpl.java
private Collection<String> splitSearchTermAndRemoveIgnoredCharacters(String searchTerm) { String[] searchTerms = StringUtils.split(searchTerm, " "); List<String> result = new ArrayList<String>(searchTerms.length); for (String term : searchTerms) { if (StringUtils.isNotEmpty(term)) { result.add(IGNORED_CHARS_PATTERN.matcher(term).replaceAll(" ")); }/*from w ww . ja v a 2 s.c o m*/ } return result; }
From source file:com.anrisoftware.globalpom.format.measurement.ValueRenderer.java
public String formatValue(Value value) { NumberFormat format = numberFormat(value.getValue()); NumberFormat uncformat = numberFormat(value.getUncertainty()); String str = valueFormatFactory.create(valueFactory, exactValueFactory, format, uncformat).format(value); String[] split = StringUtils.split(str, ";"); return split[0]; }
From source file:com.anrisoftware.sscontrol.dhclient.internal.RequestsStatementImpl.java
public void request(String option) throws AppException { String[] str = StringUtils.split(option, ","); request(Arrays.asList(str)); }
From source file:de.chludwig.websec.saml2sp.security.SAMLUserDetailsServiceImpl.java
private List<GrantedAuthority> getGrantedAuthorities(SAMLCredential credential) { String rolesClaim = credential.getAttributeAsString("http://wso2.org/claims/role"); List<GrantedAuthority> authorities = new ArrayList<>(); if (StringUtils.isNotBlank(rolesClaim)) { String[] splitRolesClaim = StringUtils.split(rolesClaim, ","); for (String roleClaim : splitRolesClaim) { RoleId roleId = RoleId.valueById(roleClaim); if (roleId != null) { authorities.add(new SimpleGrantedAuthority(roleId.getId())); }/*w w w. jav a2 s .c om*/ } } // fallback in case the IdP did not provide any role claims if (authorities.isEmpty()) { authorities.add(new SimpleGrantedAuthority(RoleId.USER_ROLE_ID.getId())); } return Collections.unmodifiableList(authorities); }
From source file:com.sonicle.webtop.vfs.SetupDataGoogleDrive.java
@Override public String generateURI() throws URISyntaxException { String[] tokens = StringUtils.split(accountEmail, "@"); return Store.buildURI("googledrive", tokens[1], null, tokens[0], accessToken, null); }