Example usage for org.apache.commons.lang StringUtils substringAfterLast

List of usage examples for org.apache.commons.lang StringUtils substringAfterLast

Introduction

In this page you can find the example usage for org.apache.commons.lang StringUtils substringAfterLast.

Prototype

public static String substringAfterLast(String str, String separator) 

Source Link

Document

Gets the substring after the last occurrence of a separator.

Usage

From source file:com.intuit.tank.util.ComponentUtil.java

/**
 * extracs the string after the last occurence of the seperator character ':'
 * //w w  w  .  j  ava  2  s .c  o m
 * @param clientId
 * @return
 */
public static String extractId(String clientId) {
    if (StringUtils.contains(clientId, ':')) {
        clientId = StringUtils.substringAfterLast(clientId, ":");
    }
    return clientId;
}

From source file:com.adobe.acs.commons.version.impl.EvolutionPathUtil.java

public static int getDepthForPath(String path) {
    return StringUtils.countMatches(StringUtils.substringAfterLast(path, "jcr:frozenNode"), "/");
}

From source file:com.adobe.acs.commons.version.impl.EvolutionPathUtil.java

public static String getRelativePropertyName(String path) {
    return StringUtils.substringAfterLast(path, "jcr:frozenNode").replaceFirst("/", "");
}

From source file:com.adobe.acs.commons.version.impl.EvolutionPathUtil.java

public static String getRelativeResourceName(String path) {
    return StringUtils.substringAfterLast(path, "jcr:frozenNode/");
}

From source file:com.adobe.acs.commons.version.impl.EvolutionPathUtil.java

public static int getLastDepthForPath(String path) {
    return StringUtils.countMatches(StringUtils.substringAfterLast(path, "jcr:content"), "/");
}

From source file:com.mmj.app.web.tools.PicTools.java

/**
 * ??/*from ww w  .  j  ava 2s  .  c o  m*/
 * 
 * @param url
 * @param picSize
 * @return
 */
public static String processURL(String url, String suffix) {
    if (StringUtils.isEmpty(url)) {
        return StringUtils.EMPTY;
    }
    if (StringUtils.isEmpty(suffix)) {
        return url;
    }
    String pefix = url;
    if (StringUtils.contains(url, "=")) {
        pefix = StringUtils.substringBeforeLast(url, "=");
    } else if (StringUtils.contains(url, "=C")) {
        pefix = StringUtils.substringBeforeLast(url, "=C");
    } else {
        pefix = StringUtils.substringBeforeLast(url, DOT);
    }
    String dotStr = StringUtils.substringAfterLast(url, DOT);
    return pefix + suffix + DOT + dotStr;
}

From source file:com.adobe.acs.commons.version.impl.EvolutionPathUtil.java

public static String getLastRelativePropertyName(String path) {
    return StringUtils.substringAfterLast(path, "jcr:content").replaceFirst("/", "");
}

From source file:com.adobe.acs.commons.version.impl.EvolutionPathUtil.java

public static String getLastRelativeResourceName(String path) {
    return StringUtils.substringAfterLast(path, "jcr:content/");
}

From source file:it.plugins.Project.java

public static Iterable<String> allFilesInDir(final String dirPath) {
    Collection<File> files = FileUtils.listFiles(new File(basedir(), dirPath), null, true);
    return from(files).transform(new Function<File, String>() {
        @Nullable/*  w w  w  .j  a  v  a2s  . c  o m*/
        public String apply(File file) {
            // transforms /absolute/path/to/src/java/Foo.java to src/java/Foo.java
            String filePath = FilenameUtils.separatorsToUnix(file.getPath());
            return dirPath + StringUtils.substringAfterLast(filePath, dirPath);
        }
    });
}

From source file:com.intellij.lang.jsgraphql.ide.documentation.JSGraphQLDocumentationPsiElement.java

public JSGraphQLDocumentationPsiElement(PsiElement context, String link) {
    this.context = context;
    this.type = StringUtils.substringAfterLast(link, "/");
}