List of usage examples for org.apache.commons.lang3 StringUtils lastIndexOf
public static int lastIndexOf(final CharSequence seq, final CharSequence searchSeq)
Finds the last index within a CharSequence, handling null .
From source file:com.quancheng.plugin.common.CommonUtils.java
public static String findPojoTypeFromCache(String sourceType, Map<String, String> pojoTypes) { String type = StringUtils.substring(sourceType, StringUtils.lastIndexOf(sourceType, ".") + 1); return pojoTypes.get(type); }
From source file:com.quancheng.plugin.common.CommonUtils.java
public static String findNotIncludePackageType(String sourceType) { String type = StringUtils.substring(sourceType, StringUtils.lastIndexOf(sourceType, ".") + 1); return type;/* w w w . j a v a 2s. com*/ }
From source file:net.mindengine.blogix.utils.BlogixUtils.java
public static Pair<Class<?>, Method> readClassAndMethodFromParsedString(ClassLoader[] classLoaders, String parsedString, String[] defaultPackages) { int id = StringUtils.lastIndexOf(parsedString, "."); if (id > 0) { String methodName = parsedString.substring(id + 1); String classPath = parsedString.substring(0, id); return findClassAndMethod(classLoaders, classPath, methodName, defaultPackages); } else//from w w w . j a v a 2 s .c o m throw new RouteParserException("Cannot parse controller definition '" + parsedString + "'"); }
From source file:com.slothpetrochemical.bridgeprob.BridgeProblemSignature.java
private static CharSequence stripFlashlight(final CharSequence seq) { int lastIdx = StringUtils.lastIndexOf(seq, FLASHLIGHT); return lastIdx >= 0 ? seq.subSequence(0, lastIdx) : seq; }
From source file:kenh.expl.functions.LastIndexOf.java
public int process(String seq, String searchSeq, boolean ignoreCase) { if (ignoreCase) return StringUtils.lastIndexOfIgnoreCase(seq, searchSeq); else/*from w w w. j a va2 s . com*/ return StringUtils.lastIndexOf(seq, searchSeq); }
From source file:de.blizzy.documentr.web.util.FacadeHostRequestWrapper.java
public static String buildFacadeUrl(String url, String contextPath, String documentrHost) { contextPath = StringUtils.defaultIfBlank(contextPath, StringUtils.EMPTY); if (contextPath.equals("/")) { //$NON-NLS-1$ contextPath = StringUtils.EMPTY; }//from www .j a v a 2s. co m String newUrl; if (StringUtils.isNotBlank(contextPath)) { int pos = url.indexOf(contextPath); newUrl = documentrHost + url.substring(pos + contextPath.length()); } else { UriComponentsBuilder builder; try { builder = UriComponentsBuilder.fromHttpUrl(url); } catch (IllegalArgumentException e) { builder = UriComponentsBuilder.fromUriString(url); } String path = StringUtils.defaultIfBlank(builder.build().getPath(), StringUtils.EMPTY); if (StringUtils.isNotBlank(path)) { int pos = StringUtils.lastIndexOf(url, path); newUrl = documentrHost + url.substring(pos); } else { newUrl = documentrHost; } } return newUrl; }
From source file:com.slothpetrochemical.bridgeprob.BridgeProblemSignature.java
@Override public boolean isFlashlightOnLeft() { CharSequence leftSegment = this.getLeftSegment(); return StringUtils.lastIndexOf(leftSegment, FLASHLIGHT) > -1; }
From source file:com.sonicle.webtop.core.versioning.SqlUpgradeScript.java
public SqlUpgradeScript(String jarResourceName) throws IOException, UnsupportedOperationException { InputStream is = null;/*from w w w .j a v a2s. c o m*/ BufferedReader br = null; try { String filename = StringUtils.substring(jarResourceName, StringUtils.lastIndexOf(jarResourceName, "/") + 1); Matcher matcher = PATTERN_JAR_FILENAME.matcher(filename); if (!matcher.matches()) throw new UnsupportedOperationException(MessageFormat.format("Bad resource name [{0}]", filename)); this.resourceName = jarResourceName; this.fileName = matcher.group(1); this.fileVersion = new ServiceVersion(matcher.group(2)); this.fileSequence = matcher.group(3); is = LangUtils.findClassLoader(getClass()).getResourceAsStream(jarResourceName); if (is == null) { is = getClass().getResourceAsStream(jarResourceName); if (is == null) throw new ResourceNotFoundException("Null InputStream!"); } readFile(new InputStreamReader(is, "ISO-8859-15"), true); //br = new BufferedReader(new InputStreamReader(is, "ISO-8859-15")); //readFile(br); } finally { IOUtils.closeQuietly(br); IOUtils.closeQuietly(is); } }
From source file:com.adguard.filter.rules.UrlFilterRule.java
/** * Creates url filter rule/*from www . j a v a 2s . c o m*/ * * @param ruleText Rule text */ public UrlFilterRule(String ruleText) { super(ruleText); String urlRuleText = ruleText; if (StringUtils.startsWith(urlRuleText, MASK_WHITE_LIST)) { urlRuleText = urlRuleText.substring(MASK_WHITE_LIST.length()); whiteListRule = true; } int optionsIndex = StringUtils.lastIndexOf(urlRuleText, OPTIONS_DELIMITER); if (optionsIndex > -1) { urlRuleText = urlRuleText.substring(0, optionsIndex); } // Transform to punycode urlRuleText = toPunycode(urlRuleText); // More about regex rules http://jira.performix.ru/browse/AG-6604 boolean regexRule = urlRuleText.startsWith(MASK_REGEX_RULE) && urlRuleText.endsWith(MASK_REGEX_RULE); if (!regexRule) { // Searching for shortcut for normal rules shortcut = findShortcut(urlRuleText); } }
From source file:com.jaspersoft.jasperserver.jrsh.completion.completer.RepositoryNameCompleter.java
private String getPreviousPath(String path) { int idx = StringUtils.lastIndexOf(path, "/"); return idx > 0 ? path.substring(0, idx) : path.substring(0, idx + 1); }