List of usage examples for org.apache.commons.lang3 StringUtils substringAfter
public static String substringAfter(final String str, final String separator)
Gets the substring after the first occurrence of a separator.
From source file:de.micromata.genome.util.matcher.BeanInspektorMatcherFactory.java
/** * Creates a new BeanInspektorMatcher object. * * @param pattern the pattern/*www.ja va2 s.com*/ * @return the matcher */ @Override public Matcher<Object> createMatcher(String pattern) { String matcherString = StringUtils.trim(StringUtils.substringBefore(pattern, "=")); String valueString = StringUtils.trimToNull(StringUtils.substringAfter(pattern, "=")); if (matcherString.trim().equals("instanceOf")) { try { // TODO (RK) wirklich nur von root classloader, nicht thread? return new BeanInstanceOfMatcher(Class.forName(valueString.trim())); } catch (Exception ex) { throw new RuntimeException(ex); // TODO better ex } } return new BeanPropertiesMatcher(matcherString, valueString); }
From source file:kenh.expl.functions.SubstringAfter.java
public String process(String str, String open, boolean last) { if (last)//from w ww . ja va2 s . c om return StringUtils.substringAfterLast(str, open); else return StringUtils.substringAfter(str, open); }
From source file:com.thinkbiganalytics.nifi.feedmgr.NifiEnvironmentProperties.java
/** * resolve the Nifi Property from the env controllerServiceProperty *///w w w . j a v a2 s . c o m public static String environmentPropertyToControllerServiceProperty(String envProperty) { String prop = envProperty; prop = StringUtils.substringAfter(prop, getPrefix()); String serviceName = StringUtils.substringBefore(prop, "."); prop = StringUtils.substringAfter(prop, "."); prop = environmentPropertyToNifi(prop); return prop; }
From source file:com.sonar.maven.it.suite.AbstractMavenTest.java
protected static Version mojoVersion() { if (mojoVersion == null) { try {//from w w w . j av a2s . c o m for (String line : Files.readAllLines(Paths.get("../pom.xml"), StandardCharsets.UTF_8)) { if (line.startsWith(" <version>")) { String version = StringUtils.substringAfter(line, "<version>"); version = StringUtils.substringBefore(version, "</version>"); mojoVersion = Version.create(version); return mojoVersion; } } } catch (IOException e) { throw new IllegalStateException(e); } throw new IllegalStateException("Unable to find version of the Maven plugin to be used by ITs"); } return mojoVersion; }
From source file:de.blizzy.documentr.markdown.macro.impl.LabelMacro.java
@Override public String getHtml(IMacroContext macroContext) { String params = macroContext.getParameters(); String type = StringUtils.substringBefore(params, " ").trim(); //$NON-NLS-1$ String text = StringUtils.substringAfter(params, " ").trim(); //$NON-NLS-1$ return "<span class=\"label label-" + StringEscapeUtils.escapeHtml4(type) + "\">" + //$NON-NLS-1$ //$NON-NLS-2$ StringEscapeUtils.escapeHtml4(text) + "</span>"; //$NON-NLS-1$ }
From source file:com.mgmtp.jfunk.data.generator.data.Field.java
public Field(final String id, final boolean unique, final String className) { this.dataKey = StringUtils.substringBefore(id, "."); this.entryKey = StringUtils.substringAfter(id, "."); this.unique = unique; this.className = className; }
From source file:com.canalplus.reco.interactclient.InteractRestClient.java
private static NameValuePairImpl[] convertAudienceID(List<Parametre> profil) { final List<NameValuePairImpl> audienceIDList = new ArrayList<NameValuePairImpl>(); for (final Parametre parametre : profil) { if (parametre.getName() != null && parametre.getName().startsWith(Consts.PREFIX_AUDIENCE_ID)) { final NameValuePairImpl audienceID = new NameValuePairImpl( StringUtils.substringAfter(parametre.getName(), Consts.PREFIX_AUDIENCE_ID), NameValuePair.DATA_TYPE_NUMERIC, Double.valueOf(parametre.getValue())); audienceIDList.add(audienceID); }//from w w w . ja va2 s . com } final NameValuePairImpl[] audienceIDArray = audienceIDList .toArray(new NameValuePairImpl[audienceIDList.size()]); return audienceIDArray; }
From source file:com.yqboots.fss.util.ZipUtils.java
/** * Compresses the specified directory to a zip file * * @param dir the directory to compress/* ww w . java2s. c om*/ * @return the compressed file * @throws IOException */ public static Path compress(Path dir) throws IOException { Assert.isTrue(Files.exists(dir), "The directory does not exist: " + dir.toAbsolutePath()); Assert.isTrue(Files.isDirectory(dir), "Should be a directory: " + dir.toAbsolutePath()); Path result = Paths.get(dir.toAbsolutePath() + FileType.DOT_ZIP); try (final ZipOutputStream out = new ZipOutputStream( new BufferedOutputStream(new FileOutputStream(result.toFile())))) { // out.setMethod(ZipOutputStream.DEFLATED); final byte data[] = new byte[BUFFER]; // get a list of files from current directory Files.walkFileTree(dir, new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(final Path path, final BasicFileAttributes attrs) throws IOException { final File file = path.toFile(); // compress to relative directory, not absolute final String root = StringUtils.substringAfter(file.getParent(), dir.toString()); try (final BufferedInputStream origin = new BufferedInputStream(new FileInputStream(file), BUFFER)) { final ZipEntry entry = new ZipEntry(root + File.separator + path.getFileName()); out.putNextEntry(entry); int count; while ((count = origin.read(data, 0, BUFFER)) != -1) { out.write(data, 0, count); } } return FileVisitResult.CONTINUE; } }); } return result; }
From source file:io.wcm.devops.maven.nodejsproxy.resource.Checksums.java
/** * @param data Checksums file content//from w w w . j a v a 2 s . com */ public Checksums(String data) { String[] lines = StringUtils.split(data, "\n"); for (String line : lines) { String checksum = StringUtils.substringBefore(line, " "); String filename = StringUtils.substringAfter(line, " "); if (StringUtils.isNoneBlank(checksum, filename)) { checksums.put(filename, checksum); } } }
From source file:de.micromata.genome.gwiki.page.impl.wiki.rte.els.RteCodeDomElementListener.java
@Override public boolean listen(DomElementEvent event) { GWikiWikiParserContext parseContext = event.getParseContext(); parseContext.flushText();//from w w w . java2s . c o m String cls = event.getStyleClass(); String lang = StringUtils.substringAfter(cls, "language-"); String text = event.walker.walkChildsCollectText(); String header = "code:lang=" + lang; MacroAttributes attrs = new MacroAttributes(header); attrs.setBody(text); GWikiMacroFragment macroFragment = parseContext.createMacro(attrs); parseContext.addFragment(macroFragment); return false; }