当前位置: 首页>>代码示例>>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;未经允许,请勿转载。