当前位置: 首页>>代码示例>>Java>>正文


Java StringUtils.substringBeforeLast方法代码示例

本文整理汇总了Java中org.apache.commons.lang.StringUtils.substringBeforeLast方法的典型用法代码示例。如果您正苦于以下问题:Java StringUtils.substringBeforeLast方法的具体用法?Java StringUtils.substringBeforeLast怎么用?Java StringUtils.substringBeforeLast使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.lang.StringUtils的用法示例。


在下文中一共展示了StringUtils.substringBeforeLast方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: findByPath

import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
public Task findByPath(String path) {
    if (!GUtil.isTrue(path)) {
        throw new InvalidUserDataException("A path must be specified!");
    }
    if (!path.contains(Project.PATH_SEPARATOR)) {
        return findByName(path);
    }

    String projectPath = StringUtils.substringBeforeLast(path, Project.PATH_SEPARATOR);
    ProjectInternal project = this.project.findProject(!GUtil.isTrue(projectPath) ? Project.PATH_SEPARATOR : projectPath);
    if (project == null) {
        return null;
    }
    projectAccessListener.beforeRequestingTaskByPath(project);

    return project.getTasks().findByName(StringUtils.substringAfterLast(path, Project.PATH_SEPARATOR));
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:18,代码来源:DefaultTaskContainer.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: check

import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
private void check(AlarmRule rule, NodeAlarmEvent alarmEvent) {
    if (!inPeriod(rule)) {
        return;
    }

    String matchValue = rule.getMatchValue();
    matchValue = StringUtils.substringBeforeLast(matchValue, "@");

    String[] matchValues = StringUtils.split(matchValue, ",");

    for (String match : matchValues) {
        if (StringUtils.containsIgnoreCase(alarmEvent.getMessage(), match)) {
            String message = String.format(MESAGE_FORMAT, alarmEvent.getPipelineId(), alarmEvent.getNid(),
                                           alarmEvent.getMessage());
            sendAlarm(rule, message);
            break;
        }
    }
}
 
开发者ID:luoyaogui,项目名称:otter-G,代码行数:20,代码来源:ExceptionRuleMonitor.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: addPackageForClass

import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
private PackageTestResults addPackageForClass(String className) {
    String packageName = StringUtils.substringBeforeLast(className, ".");
    if (packageName.equals(className)) {
        packageName = "";
    }
    return addPackage(packageName);
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:8,代码来源:AllTestResults.java

示例6: 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

示例7: checkTimeout

import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
private String checkTimeout(AlarmRule rule, Map<Long, Long> processTime) {
    if (!inPeriod(rule)) {
        return StringUtils.EMPTY;
    }

    String matchValue = rule.getMatchValue();
    matchValue = StringUtils.substringBeforeLast(matchValue, "@");
    Long maxSpentTime = Long.parseLong(StringUtils.trim(matchValue));
    List<Long> timeoutProcessIds = new LinkedList<Long>();
    Collections.sort(timeoutProcessIds);
    long maxSpent = 0;
    for (Entry<Long, Long> entry : processTime.entrySet()) {
        // maxSpentTime 是秒,而processTime的value是毫秒
        if (entry.getValue() >= (maxSpentTime * 1000)) {
            timeoutProcessIds.add(entry.getKey());
            maxSpent = maxSpent > entry.getValue() ? maxSpent : entry.getValue();
        }
    }

    if (CollectionUtils.isEmpty(timeoutProcessIds)) {
        return StringUtils.EMPTY;
    }

    String processIds = StringUtils.join(timeoutProcessIds, ",");
    String message = String.format(TIME_OUT_MESSAGE, rule.getPipelineId(), processIds, (maxSpent / 1000));
    sendAlarm(rule, message);
    return message;
}
 
开发者ID:luoyaogui,项目名称:otter-G,代码行数:29,代码来源:ProcessTimeoutRuleMonitor.java

示例8: checkDelayTime

import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
private boolean checkDelayTime(AlarmRule rule, Long delayTime) {

        if (!inPeriod(rule)) {
            return false;
        }

        String matchValue = rule.getMatchValue();
        matchValue = StringUtils.substringBeforeLast(matchValue, "@");
        Long maxDelayTime = Long.parseLong(StringUtils.trim(matchValue));
        if (delayTime >= maxDelayTime * 1000) {
            sendAlarm(rule, String.format(DELAY_TIME_MESSAGE, rule.getPipelineId(), delayTime));
            return true;
        }
        return false;
    }
 
开发者ID:luoyaogui,项目名称:otter-G,代码行数:16,代码来源:DelayStatRuleMonitor.java

示例9: checkTimeout

import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
private boolean checkTimeout(AlarmRule rule, long elapsed) {
    if (!inPeriod(rule)) {
        return false;
    }

    String matchValue = rule.getMatchValue();
    matchValue = StringUtils.substringBeforeLast(matchValue, "@");
    Long maxSpentTime = Long.parseLong(StringUtils.trim(matchValue));
    // sinceLastSync是毫秒,而 maxSpentTime 是秒
    if (elapsed >= (maxSpentTime * 1000)) {
        sendAlarm(rule, String.format(TIME_OUT_MESSAGE, rule.getPipelineId(), (elapsed / 1000)));
        return true;
    }
    return false;
}
 
开发者ID:luoyaogui,项目名称:otter-G,代码行数:16,代码来源:PositionTimeoutRuleMonitor.java

示例10: validate

import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
/**
 * Validates given component state
 * 
 * @param {@link Component}
 * @return true - if component has valid state
 */
public boolean validate(Component component){
	PropertyToolTipInformation propertyToolTipInformation= new PropertyToolTipInformation(ISSUE_PROPERTY_NAME, HIDE_TOOLTIP, TOOLTIP_DATATYPE);
	boolean validationStatus=true;
	String errorMessages="";
	if(componentValidators!=null && componentValidators.containsKey(component.getType().toUpperCase())){
		for(IComponentValidator componentValidator: componentValidators.get(component.getType().toUpperCase())){
			
			String errorMessage = componentValidator.validateComponent(component);
			if(errorMessage!=null){
				errorMessages = errorMessages + errorMessage + "\n";
			}
		}
		
		errorMessages=StringUtils.substringBeforeLast(errorMessages, "\n");
		
		if(!StringUtils.isEmpty(errorMessages)){
			propertyToolTipInformation= new PropertyToolTipInformation(ISSUE_PROPERTY_NAME, SHOW_TOOLTIP, TOOLTIP_DATATYPE);
			propertyToolTipInformation.setPropertyValue(errorMessages);
			validationStatus = false;
		}
		
		component.getTooltipInformation().put(ISSUE_PROPERTY_NAME,propertyToolTipInformation );
	}
	
	return validationStatus;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:33,代码来源:ComponentValidator.java

示例11: 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

示例12: determineName

import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
private static String determineName(File file) {
    return StringUtils.substringBeforeLast(file.getName(), ".");
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:4,代码来源:LibraryPublishArtifact.java

示例13: getStrutsForwardNameFromPath

import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
/**
    * <p>
    * This helper method create the struts action forward name using the path. It will chop all path related
    * characters, such as "/" and ".do".
    * </p>
    *
    * <p>
    * For example:
    * <li><code>getStrutsForwardNameFromPath("/DisplayParallelActivity.do")<code>
    * = displayParallelActivity</li>
    * </p>
    *
    * @param path
    * @return
    */
   public static String getStrutsForwardNameFromPath(String path) {
String pathWithoutSlash = StringUtils.substringAfter(path, "/");
String orginalForwardName = StringUtils.substringBeforeLast(pathWithoutSlash, ".do");

return StringUtils.uncapitalize(orginalForwardName);

   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:23,代码来源:WebUtil.java

示例14: getUnitUrl

import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
/**
 * getUnitUrl.
 * @param cellUrl String
 * @param index int from last
 * @return url String
 */
public static String getUnitUrl(String cellUrl, int index) {
    String[] list = cellUrl.split(STRING_SLASH);
    // 指定文字が最後から指定数で発見された文字より前の文字を切り出す
    return StringUtils.substringBeforeLast(cellUrl, list[list.length - index]);
}
 
开发者ID:personium,项目名称:personium-core,代码行数:12,代码来源:UriUtils.java


注:本文中的org.apache.commons.lang.StringUtils.substringBeforeLast方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。