List of usage examples for org.apache.commons.lang3 StringUtils ordinalIndexOf
public static int ordinalIndexOf(final CharSequence str, final CharSequence searchStr, final int ordinal)
Finds the n-th index within a CharSequence, handling null .
From source file:com.github.riccardove.easyjasub.commons.CommonsLangStringUtils.java
public static int ordinalIndexOf(String str, String searchStr, int ordinal) { return StringUtils.ordinalIndexOf(str, searchStr, ordinal); }
From source file:com.thinkbiganalytics.metadata.jpa.app.JpaKyloVersionProvider.java
private KyloVersion parseVersionString(String versionString) { if (versionString != null) { JpaKyloVersion kyloVersion = new JpaKyloVersion(); //Major version ends before second period //i.e. v 0.3.0 0.3 int beforeIndex = StringUtils.ordinalIndexOf(versionString, ".", 2); String majorVersionString = StringUtils.substring(versionString, 0, beforeIndex); String minorVersion = StringUtils.substring(versionString, (beforeIndex + 1)); kyloVersion.setMajorVersion(majorVersionString); kyloVersion.setMinorVersion(minorVersion); return kyloVersion; }//ww w. ja va 2 s.c o m return null; }
From source file:de.teamgrit.grit.preprocess.fetch.SvnFetcher.java
/** * Updates the directory path for remote svn repos. * * @param location/* w w w . ja v a 2s.c om*/ * the adress of the repo * @param oldPath * the current path * @return an updated path */ private static Path updateDirectoryPath(String location, Path oldPath) { Path targetDirectory = Paths.get(oldPath.toAbsolutePath().toString()); // check whether the svn repo is given via a url or is given via a path if (!location.startsWith("file://")) { // We need to get the name of the checked out folder / repo. int occurences = StringUtils.countMatches(location, "/"); int index = StringUtils.ordinalIndexOf(location, "/", occurences); String temp = location.substring(index + 1); // stitch the last part of the hyperlink to the targetDirectory to // receive the structure targetDirectory = Paths.get(targetDirectory.toString(), temp); } else { targetDirectory = targetDirectory.resolve(Paths.get(location).getFileName()); } return targetDirectory; }
From source file:DatasetCreation.DatasetCSVBuilder.java
/** * Return CSV line of the top X features from the given dataset line * * @param csvLine the original dataset CSV line to extract top X features * from/*from ww w . java 2 s .c o m*/ * @param topX top X features to extract * @return CSV line of the top X features from the given dataset line */ private static String GetTopXCSVLine(String csvLine, int topX, boolean elementIDColumnExist, boolean classificationColumnExist) { int indexOfLastTop = StringUtils.ordinalIndexOf(csvLine, ",", topX + ((elementIDColumnExist) ? 1 : 0)); String topFeatures = csvLine.substring(0, indexOfLastTop + 1); String classColumn = ""; if (classificationColumnExist) { int indexOdfirstClassColumn = csvLine.lastIndexOf(",") + 1; classColumn = csvLine.substring(indexOdfirstClassColumn, csvLine.length()); } return topFeatures + classColumn; }
From source file:org.apache.kylin.storage.hdfs.ITHDFSResourceStoreTest.java
private String getHdfsWorkingDirWithoutScheme(KylinConfig kylinConfig) { String hdfsWorkingDir = kylinConfig.getHdfsWorkingDirectory(); int thirdIndex = StringUtils.ordinalIndexOf(hdfsWorkingDir, "/", 3); int fourthIndex = StringUtils.ordinalIndexOf(hdfsWorkingDir, "/", 5); return hdfsWorkingDir.substring(thirdIndex, fourthIndex); }
From source file:org.dbgl.model.WebProfile.java
public String getCoreGameCoverUrlWithoutPathPrefix() { int index = StringUtils.ordinalIndexOf(coreGameCoverUrl, "/", 3); if (index > 0) return coreGameCoverUrl.substring(index + 1); return coreGameCoverUrl; }
From source file:org.janusgraph.graphdb.tinkerpop.gremlin.server.auth.HMACAuthenticator.java
private String getBcryptSaltFromStoredPassword(String password) { Integer saltStart = StringUtils.ordinalIndexOf(password, "$", 3); return password.substring(saltStart + 1, saltStart + 23); }
From source file:org.jbpm.designer.web.server.ServiceRepoUtils.java
public static String getRepositoryDir(String uuid) { int aStart = uuid.indexOf("//"); String tmpUUID = uuid.substring(aStart + 2); int bStart = StringUtils.ordinalIndexOf(tmpUUID, "/", 2); int aEnd = tmpUUID.lastIndexOf('/'); return tmpUUID.substring(bStart, aEnd); }
From source file:org.schedoscope.metascope.schedoscope.model.View.java
public String getViewId() { int index = StringUtils.ordinalIndexOf(name, "/", 2) + 1; String[] parameterValues = name.substring(index).split("/"); String result = ""; if (parameterValues.length == 1 && parameterValues[0].isEmpty()) { return "root"; }/*from www .j av a2 s .com*/ for (int i = 0; i < parameterValues.length; i++) { result += parameterValues[i]; } return result; }
From source file:org.schedoscope.metascope.task.model.View.java
public String viewPath() { int index = StringUtils.ordinalIndexOf(name, "/", 2) + 1; return name.substring(0, index); }