當前位置: 首頁>>代碼示例>>Java>>正文


Java StringUtils.substringAfterLast方法代碼示例

本文整理匯總了Java中org.apache.commons.lang.StringUtils.substringAfterLast方法的典型用法代碼示例。如果您正苦於以下問題:Java StringUtils.substringAfterLast方法的具體用法?Java StringUtils.substringAfterLast怎麽用?Java StringUtils.substringAfterLast使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.commons.lang.StringUtils的用法示例。


在下文中一共展示了StringUtils.substringAfterLast方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getOrCreateAreaNode

import org.apache.commons.lang.StringUtils; //導入方法依賴的package包/類
private JCRNodeWrapper getOrCreateAreaNode(String areaPath, JCRSessionWrapper session) throws RepositoryException {
    JCRNodeWrapper areaParentNode = session.getNode(StringUtils.substringBeforeLast(areaPath, "/"));
    String areaName = StringUtils.substringAfterLast(areaPath, "/");
    JCRNodeWrapper areaNode = null;
    try {
        areaNode = areaParentNode.getNode(areaName);
    } catch (PathNotFoundException e) {
        try {
            areaNode = areaParentNode.addNode(areaName, areaType);
            session.save();
        } catch (ItemExistsException e1) {
            // possible race condition when page is accessed concurrently in edit mode
            areaNode = areaParentNode.getNode(areaName);
        }
    }
    return areaNode;
}
 
開發者ID:DantaFramework,項目名稱:JahiaDF,代碼行數:18,代碼來源:AreaTag.java

示例2: SimpleEsAdapter

import org.apache.commons.lang.StringUtils; //導入方法依賴的package包/類
public SimpleEsAdapter(CanalConf canalConf) {

        String accept = canalConf.getAccept();
        String[] acceptArr = accept.split(DELIMITER);
        for (String str : acceptArr) {
            String[] strArr = str.split(CONNECTOR);
            if (strArr.length == 3) {
                String dataBaseTable = StringUtils.substringBeforeLast(str, CONNECTOR_TEP);
                String idColumn = StringUtils.substringAfterLast(str, CONNECTOR_TEP);
                idPair.put(dataBaseTable, idColumn);

                logger.info("Add accept :{}", str);
            }
        }

    }
 
開發者ID:zhongchengxcr,項目名稱:canal-elasticsearch,代碼行數:17,代碼來源:SimpleEsAdapter.java

示例3: determinePrefix

import org.apache.commons.lang.StringUtils; //導入方法依賴的package包/類
private String determinePrefix() {
    StackTraceElement[] stackTrace = new RuntimeException().getStackTrace();
    for (StackTraceElement element : stackTrace) {
        if (element.getClassName().endsWith("Test") || element.getClassName().endsWith("Spec")) {
            return StringUtils.substringAfterLast(element.getClassName(), ".") + "/unknown-test";
        }
    }
    return "unknown-test-class";
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:10,代碼來源:AbstractTestDirectoryProvider.java

示例4: ArtifactFile

import org.apache.commons.lang.StringUtils; //導入方法依賴的package包/類
public ArtifactFile(File file, String version) {
    name = file.getName();
    extension = "";
    classifier = "";
    boolean done = false;

    int startVersion = StringUtils.lastIndexOf(name, "-" + version);
    if (startVersion >= 0) {
        int endVersion = startVersion + version.length() + 1;
        if (endVersion == name.length()) {
            name = name.substring(0, startVersion);
            done = true;
        } else if (endVersion < name.length() && name.charAt(endVersion) == '-') {
            String tail = name.substring(endVersion + 1);
            name = name.substring(0, startVersion);
            classifier = StringUtils.substringBeforeLast(tail, ".");
            extension = StringUtils.substringAfterLast(tail, ".");
            done = true;
        } else if (endVersion < name.length() && StringUtils.lastIndexOf(name, ".") == endVersion) {
            extension = name.substring(endVersion + 1);
            name = name.substring(0, startVersion);
            done = true;
        }
    }
    if (!done) {
        extension = StringUtils.substringAfterLast(name, ".");
        name = StringUtils.substringBeforeLast(name, ".");
    }
    if (classifier.length() == 0) {
        classifier = null;
    }
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:33,代碼來源:ArtifactFile.java

示例5: getSimpleName

import org.apache.commons.lang.StringUtils; //導入方法依賴的package包/類
public String getSimpleName() {
    String simpleName = StringUtils.substringAfterLast(name, ".");
    if (simpleName.equals("")) {
        return name;
    }
    return simpleName;
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:8,代碼來源:ClassTestResults.java

示例6: addResource

import org.apache.commons.lang.StringUtils; //導入方法依賴的package包/類
Resource addResource(URL source) {
    String urlString = source.toString();
    Resource resource = resources.get(urlString);
    if (resource == null) {
        String name = StringUtils.substringAfterLast(source.getPath(), "/");
        String type = StringUtils.substringAfterLast(source.getPath(), ".");
        if (type.equalsIgnoreCase("png") || type.equalsIgnoreCase("gif")) {
            type = "images";
        }
        String path = type + "/" + name;
        resource = new Resource(source, path);
        resources.put(urlString, resource);
    }
    return resource;
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:16,代碼來源:HtmlReportRenderer.java

示例7: fetchZkNodeRecursively

import org.apache.commons.lang.StringUtils; //導入方法依賴的package包/類
private void fetchZkNodeRecursively(String parentNode, List<String> resultNodesInfo, CuratorFramework curator) throws Exception {
    List<String> children = curator.getChildren().forPath(parentNode);
    if (!children.isEmpty()) {
        for (String curNode : children) {
            fetchZkNodeRecursively(parentNode + "/" + curNode, resultNodesInfo, curator);
        }
    } else {
        String ver = StringUtils.substringAfterLast(parentNode, "/");
        if(isStr2Num(ver)) {
            resultNodesInfo.add(parentNode);
        }
    }
}
 
開發者ID:BriData,項目名稱:DBus,代碼行數:14,代碼來源:CheckFullPullEvent.java

示例8: filter

import org.apache.commons.lang.StringUtils; //導入方法依賴的package包/類
/**
 * 獲取全量拉取的最新節點
 * @param fullPullerRootNode
 * @param curator
 * @return 子節點的全路徑,之前非全路徑,後麵的path部分進行了拚接
 * @throws Exception
 */
private List<String> filter(String fullPullerRootNode, CuratorFramework curator) throws Exception {
    List<String> flattedFullpullerNodeName = new ArrayList<>();

    //get all node list
    fetchZkNodeRecursively(fullPullerRootNode,flattedFullpullerNodeName, curator);

    HashMap<String, Integer> map = new HashMap<String, Integer>();
    for (String znode : flattedFullpullerNodeName) {
        String key = StringUtils.substringBeforeLast(znode, "/");
        String ver = StringUtils.substringAfterLast(znode, "/");
        Integer version = Integer.parseInt(ver);
        if (map.containsKey(key)) {
            Integer tempVersion = map.get(key);
            if (version > tempVersion) {
                map.put(key, version);
            }
        } else {
            map.put(key, version);
        }
    }

    List<String> wkList = new ArrayList<String>();
    for (Map.Entry<String, Integer> entry : map.entrySet()) {
        wkList.add(StringUtils.join(new String[] {entry.getKey(), String.valueOf(entry.getValue())}, "/"));
    }
    return wkList;
}
 
開發者ID:BriData,項目名稱:DBus,代碼行數:35,代碼來源:CheckFullPullEvent.java

示例9: getFromCacheOrCopy

import org.apache.commons.lang.StringUtils; //導入方法依賴的package包/類
private PluginReference getFromCacheOrCopy(final URL pluginUrl) {
  try (InputStream is = pluginUrl.openStream()) {
    String hash = org.sonarsource.sonarlint.core.util.StringUtils.md5(is);
    String filename = StringUtils.substringAfterLast(pluginUrl.getFile(), "/");
    fileCache.get(filename, hash, new FileCopier(pluginUrl));
    return new PluginReference(hash, filename);
  } catch (Exception e) {
    throw new IllegalStateException("Fail to copy plugin from URL: " + pluginUrl, e);
  }
}
 
開發者ID:instalint-org,項目名稱:instalint,代碼行數:11,代碼來源:StandalonePluginIndex.java

示例10: getLastWordAfterDot

import org.apache.commons.lang.StringUtils; //導入方法依賴的package包/類
/**
 * Split by dot and get last word
 *
 * @param stringWithDots string to get last word from
 * @return word after last dot
 */
public static String getLastWordAfterDot(String stringWithDots) {
    if (StringUtils.isBlank(stringWithDots)){
        return stringWithDots;
    }
    return stringWithDots.contains(".") ? StringUtils.substringAfterLast(stringWithDots, ".") : stringWithDots;
}
 
開發者ID:nds842,項目名稱:sql-first-mapper,代碼行數:13,代碼來源:MiscUtils.java

示例11: inPeriod

import org.apache.commons.lang.StringUtils; //導入方法依賴的package包/類
protected boolean inPeriod(AlarmRule alarmRule) {
    String rule = alarmRule.getMatchValue();
    if (StringUtils.isEmpty(rule)) {
        log.info("rule is empty " + alarmRule);
        return false;
    }

    String periods = StringUtils.substringAfterLast(rule, "@");
    if (StringUtils.isEmpty(periods)) {
        // 沒有時間要求,則任務在報警時間段內
        return isInPeriodWhenNoPeriod();
    }

    Calendar calendar = currentCalendar();
    periods = StringUtils.trim(periods);
    for (String period : StringUtils.split(periods, ",")) {
        String[] startAndEnd = StringUtils.split(period, "-");
        if (startAndEnd == null || startAndEnd.length != 2) {
            log.error("error period time format in rule : " + alarmRule);
            return isInPeriodWhenErrorFormat();
        }

        String start = startAndEnd[0];
        String end = startAndEnd[1];
        if (checkInPeriod(calendar, start, end)) {
            log.info("rule is in period : " + alarmRule);
            return true;
        }
    }

    log.info("rule is not in period : " + alarmRule);
    return false;
}
 
開發者ID:luoyaogui,項目名稱:otter-G,代碼行數:34,代碼來源:AbstractRuleMonitor.java

示例12: initProcess

import org.apache.commons.lang.StringUtils; //導入方法依賴的package包/類
protected Long initProcess() {
    String path = zookeeper.create(processPath + "/", new byte[0], CreateMode.PERSISTENT_SEQUENTIAL);

    // 創建為順序的節點
    String processNode = StringUtils.substringAfterLast(path, "/");
    return StagePathUtils.getProcessId(processNode);// 添加到當前的process列表
}
 
開發者ID:luoyaogui,項目名稱:otter-G,代碼行數:8,代碼來源:BaseStageTest.java

示例13: incrementSubVersion

import org.apache.commons.lang.StringUtils; //導入方法依賴的package包/類
private String incrementSubVersion(final String subVersion) {
    if (StringUtils.isNumeric(subVersion)) {
        return Integer.toString(Integer.parseInt(subVersion) + 1);
    }

    final String headVersionPart = StringUtils.substringBeforeLast(subVersion, ".");
    final String tailVersionPart = StringUtils.substringAfterLast(subVersion, ".");
    final Integer newSubVersion = Integer.parseInt(tailVersionPart) + 1;

    return headVersionPart + "." + newSubVersion.toString();
}
 
開發者ID:ncredinburgh,項目名稱:maven-release-yearly-policy,代碼行數:12,代碼來源:YearlyVersionPolicy.java

示例14: determineExtension

import org.apache.commons.lang.StringUtils; //導入方法依賴的package包/類
private static String determineExtension(File file) {
    return StringUtils.substringAfterLast(file.getName(), ".");
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:4,代碼來源:LibraryPublishArtifact.java

示例15: parseFile

import org.apache.commons.lang.StringUtils; //導入方法依賴的package包/類
protected MavenArtifact parseFile(File file) {
    String extension = StringUtils.substringAfterLast(file.getName(), ".");
    return instantiator.newInstance(DefaultMavenArtifact.class, file, extension, null);
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:5,代碼來源:MavenArtifactNotationParserFactory.java


注:本文中的org.apache.commons.lang.StringUtils.substringAfterLast方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。