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


Java StringUtils.substringBeforeLast方法代码示例

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


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

示例1: formatArrayColumn

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
/**
    * Format the column as an java.sqlArray
    * 
    * @param resultSet
    * @param columnIndex
    * @return
    * @throws SQLException
    * @throws IOException
    */
   private String formatArrayColumn(ResultSet resultSet, int columnIndex)
    throws SQLException, IOException {
Array array = resultSet.getArray(columnIndex);

Object[] objects = (Object[]) array.getArray();
String arrayStr = "{";
for (int i = 0; i < objects.length; i++) {
    arrayStr += objects[i] + ",";
}

if (arrayStr.contains(",")) {
    arrayStr = StringUtils.substringBeforeLast(arrayStr, ",");
}

arrayStr += "}";
return arrayStr;

/*
 * ArrayHttp arrayHttp = new ArrayHttp(array); ArrayTransporter
 * arrayTransporter = new ArrayTransporter(); String base64 =
 * arrayTransporter.toBase64(arrayHttp); return base64;
 */
   }
 
开发者ID:kawansoft,项目名称:aceql-http,代码行数:33,代码来源:ResultSetWriter.java

示例2: doFilter

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException,
        ServletException {
    YiDuConstants.singleBookFlag.set(false);
    HttpServletRequest req = (HttpServletRequest) request;
    String uri = req.getRequestURI();
    if (StringUtils.endsWithAny(uri, "css", "js", "jpg", "png", "gif")) {
        // 静态资源直接跳过
        logger.debug("ignore static resource." + uri);
        chain.doFilter(request, response);
    } else {
        // 非静态资源时,根据具体的信息去做判别,时候需要标识单本
        String rootDomian = YiDuConstants.yiduConf.getString(YiDuConfig.ROOT_DOMAIN);
        String aname = StringUtils.substringBeforeLast(req.getServerName(), "." + rootDomian);
        logger.debug("aname : " + aname);
        if (StringUtils.isNotBlank(aname)) {
            int articleno = SingleBookManager.getArticleno(aname);
            if (articleno != 0) {
                // TODO 即便找到对应的小说,也只做首页和阅读页,其他全部404吧
                Pattern p = Pattern.compile(regex);
                Matcher m = p.matcher(uri);
                boolean matchFlag = false;
                String newURI = "";
                if (m.find()) {
                    // 阅读页
                    newURI = ReaderAction.URL + "?chapterno="
                            + StringUtils.substringBeforeLast(m.group(1), ".html");
                    matchFlag = true;
                } else if (StringUtils.equals(uri, "/") || StringUtils.isEmpty(uri)) {
                    // 首页
                    newURI = InfoAction.URL + "?articleno=" + articleno;
                    matchFlag = true;
                } else {
                    // 返回404
                    YiDuConstants.singleBookFlag.set(true);
                    ((HttpServletResponse) response).sendError(HttpServletResponse.SC_NOT_FOUND);
                }
                logger.debug("newURI str: " + newURI);
                if (matchFlag) {
                    YiDuConstants.singleBookFlag.set(true);
                    YiDuConstants.singleBookServerName.set(req.getServerName());
                    req.getRequestDispatcher(newURI).forward(request, response);
                }
            } else {
                chain.doFilter(request, response);
            }
        } else {
            chain.doFilter(request, response);
        }
    }
}
 
开发者ID:luckyyeah,项目名称:YiDu-Novel,代码行数:52,代码来源:SingleBookFilter.java

示例3: constructPatternId

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
public static String constructPatternId(String patternResourcePath, String patternsPath, String templateName, String jsonDataFileName) {
    final String patternPath = StringUtils.substringAfter(patternResourcePath, patternsPath + SLASH);
    final StringBuilder patternIdBuilder = new StringBuilder();
    if (StringUtils.endsWith(patternPath, HTML_EXT)) {
        patternIdBuilder.append(StringUtils.substringBeforeLast(patternPath, HTML_EXT));
    } else {
        patternIdBuilder.append(patternPath);
    }
    if (StringUtils.isNotBlank(templateName)) {
        patternIdBuilder.append(SLASH).append(templateName);
    }
    if (StringUtils.isNotBlank(jsonDataFileName)) {
        final String patternFileName = StringUtils.substringAfterLast(patternPath, SLASH);
        final String fileNameWithoutExt = StringUtils.substringBeforeLast(patternFileName, HTML_EXT);
        final String dataFileSuffix = StringUtils.substringBetween(jsonDataFileName, fileNameWithoutExt
                + SELECTOR, DATA_EXT);
        patternIdBuilder.append(SLASH).append(StringUtils.defaultString(dataFileSuffix, fileNameWithoutExt));
    }
    return StringUtils.replace(patternIdBuilder.toString(), SLASH, PATTERN_ID_REPLACEMENT);
}
 
开发者ID:deepthinkit,项目名称:patternlab-for-sling,代码行数:21,代码来源:PatternLabUtils.java

示例4: parseRespond

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
/**
 * 解析弹幕服务器接收到的协议数据
 * @param data
 * @return
 */
public Map<String, Object> parseRespond(String data){
	Map<String, Object> rtnMsg = new HashMap<String, Object>();
	
	//处理数据字符串末尾的'/0字符'
	data = StringUtils.substringBeforeLast(data, "/");
	
	//对数据字符串进行拆分
	String[] buff = data.split("/");
	
	//分析协议字段中的key和value值
	for(String tmp : buff){
		//获取key值
		String key = StringUtils.substringBefore(tmp, "@=");
		//获取对应的value值
		Object value = StringUtils.substringAfter(tmp, "@=");
		
		//如果value值中包含子序列化值,则进行递归分析
		if(StringUtils.contains((String)value, "@A")){
			value = ((String)value).replaceAll("@S", "/").replaceAll("@A", "@");
			value = this.parseRespond((String)value);
		}
		
		//将分析后的键值对添加到信息列表中
		rtnMsg.put(key, value);
	}
	
	return rtnMsg;
	
}
 
开发者ID:lslxy1021,项目名称:DYB,代码行数:35,代码来源:MsgView.java

示例5: extract

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
public static File[] extract(File frame, Device userDevice) throws IOException {
    Mat colorFilterTextLow = new Mat(new double[] { 0, 2, 0 });
    Mat colorFilterNumberLow = new Mat(new double[] { 255, 255, 255 });
    final double threshText = 0.04d;
    final int threshTextSrcLow = 200;
    final int threshTextSrcUp = 255;

    final double threshNum = 0.06d;

    // iphone 7
    Mat colorFilterNumLow;
    Device device = userDevice != null ? userDevice : Device.ANDROID;
    switch (device) {
    case IPHONE:
        colorFilterNumLow = new Mat(new double[] { 25, 175, 50 });
        break;
    default:
        colorFilterNumLow = new Mat(new double[] { 25, 255, 50 });
        break;
    }

    Mat colorFilterNumUp = new Mat(new double[] { 50, 255, 255 });
    final int threshNumSrcLow = 180;
    final int threshNumSrcUp = 255;

    String prefix = StringUtils.substringBeforeLast(frame.getName(), "_");

    File text = process(frame, colorFilterTextLow, colorFilterNumberLow, threshText, threshTextSrcLow,
            threshTextSrcUp, CV_THRESH_BINARY, prefix + "_text");
    File number = process(frame, colorFilterNumLow, colorFilterNumUp, threshNum, threshNumSrcLow, threshNumSrcUp,
            CV_THRESH_BINARY_INV, prefix + "_num");

    colorFilterTextLow.close();
    colorFilterNumberLow.close();
    colorFilterNumLow.close();
    colorFilterNumUp.close();

    return new File[] { text, number };
}
 
开发者ID:BlackCraze,项目名称:GameResourceBot,代码行数:40,代码来源:Preprocessor.java

示例6: PatternModel

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
public PatternModel(Resource resource, String patternsPath, String patternId, ResourceResolver resourceResolver) throws IOException {
    this.id = PatternLabUtils.constructPatternId(resource.getPath(), patternsPath);
    this.name = StringUtils.lowerCase(PatternLabUtils.getResourceTitleOrName(resource));
    this.template = StringUtils.EMPTY;
    this.path = resource.getPath();
    this.dataPath = StringUtils.EMPTY;
    this.displayed = StringUtils.isBlank(patternId) || StringUtils.startsWith(getId(), patternId);
    this.breadcrumb = Lists.newArrayList(new BreadcrumbItemModel(id, name));
    this.code = PatternLabUtils.getDataFromFile(path, resourceResolver);
    this.data = null;
    final String descriptionPath = StringUtils.substringBeforeLast(path, PatternLabConstants.SELECTOR) + PatternLabConstants.DESCRIPTION_EXT;
    this.description = PatternLabUtils.getDataFromFile(descriptionPath, resourceResolver);
    this.embeddedPatterns = Sets.newHashSet();
    this.includingPatterns = Sets.newHashSet();
}
 
开发者ID:deepthinkit,项目名称:patternlab-for-sling,代码行数:16,代码来源:PatternModel.java

示例7: saveInTransaction

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
private CuratorTransaction saveInTransaction(CuratorTransaction transaction, byte[] data, String path) throws Exception {
    CuratorTransaction resultingTransaction = (transaction == null) ? getConnectedClientOrFailFast().inTransaction() : transaction;
    if (isNodeExistsInternal(path)) {
        resultingTransaction = resultingTransaction.setData().forPath(path, data).and();
    } else {
        String parentPath = StringUtils.substringBeforeLast(path, "/");
        if (!isNodeExistsInternal(parentPath)) {
            resultingTransaction = resultingTransaction.create().forPath(parentPath).and();
        }
        resultingTransaction = resultingTransaction.create().forPath(path, data).and();
    }
    return resultingTransaction;
}
 
开发者ID:Comcast,项目名称:redirector,代码行数:14,代码来源:ZookeeperConnector.java

示例8: writeBackup

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
private void writeBackup(String path, final String addressIPV6, Action action, String weight) {
    int nameIndex = path.lastIndexOf(RedirectorConstants.DELIMETER);
    String stack = path.substring(basePath.length(), nameIndex);
    final String address = StringUtils.substringBeforeLast(StringUtils.substring(path, nameIndex + 1), IP_PORT_SEPARATOR);
    StackSnapshot currentSnapshot = createStackSnapshot(stack, address, addressIPV6, weight);
    if (action.getId().equals(Action.REGISTERED.getId())) {
        discoveryStacksBackupManager.addStackSnapshot(currentSnapshot);
    } else {
        discoveryStacksBackupManager.deleteStackSnapshot(currentSnapshot);
    }
}
 
开发者ID:Comcast,项目名称:redirector,代码行数:12,代码来源:CustomServiceCache.java

示例9: getResource

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
@Override
public final Resource getResource(String pathInContext) {
	ServletContextHandler.Context context = (ServletContextHandler.Context) getServletContext();
	ServletContextHandler contextHandler = (ServletContextHandler) context.getContextHandler();
	
	for (ServletMapping mapping: contextHandler.getServletHandler().getServletMappings()) {
		if (mapping.getServletName().equals(getServletName())) {
			for (String pathSpec: mapping.getPathSpecs()) {
				String relativePath = null;
				if (pathSpec.endsWith("/*")) {
					pathSpec = StringUtils.substringBeforeLast(pathSpec, "/*");
					if (pathInContext.startsWith(pathSpec + "/")) 
						relativePath = pathInContext.substring(pathSpec.length());
				} else if (pathSpec.startsWith("*.")) {
					pathSpec = StringUtils.stripStart(pathSpec, "*");
					if (pathInContext.endsWith(pathSpec))
						relativePath = pathInContext;
				} else if (pathSpec.equals(pathInContext)) {
					relativePath = pathInContext;
				}
				if (relativePath != null) {
					relativePath = StringUtils.stripStart(relativePath, "/");
					Resource resource = Resource.newResource(loadResource(relativePath));
					if (resource != null && resource.exists())
						return resource;
				}
			}
		}
	}
	
	return null;
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:33,代码来源:AssetServlet.java

示例10: getIPv4

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
private String getIPv4(String path) {
    int nameIndex = path.lastIndexOf(RedirectorConstants.DELIMETER);
    return StringUtils.substringBeforeLast(StringUtils.substring(path, nameIndex + 1), IP_PORT_SEPARATOR);
}
 
开发者ID:Comcast,项目名称:redirector,代码行数:5,代码来源:CustomServiceCache.java

示例11: ShowQrcodeRequest

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
/**
    * 构造函数
    * @param ticket 获取的二维码ticket,凭借此ticket可以在有效时间内换取二维码
    * @param fullDownPath  下载文件路径+文件名
    */
   public ShowQrcodeRequest(String ticket, String fullDownPath) {
	this.ticket = ticket;
	this.fileName = StringUtils.substringAfterLast(fullDownPath, File.separator);
       this.filePath = StringUtils.substringBeforeLast(fullDownPath, File.separator) + File.separator;
}
 
开发者ID:rocye,项目名称:wx-idk,代码行数:11,代码来源:ShowQrcodeRequest.java

示例12: PerpetualMediaGetRequest

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
/**
 * 构造器
 * @param mediaId  		媒体文件ID
 * @param fullDownPath  下载文件路径+文件名
 */
public PerpetualMediaGetRequest(String mediaId, String fullDownPath) {
    this.media_id = mediaId;
    this.fileName = StringUtils.substringAfterLast(fullDownPath, File.separator);
    this.filePath = StringUtils.substringBeforeLast(fullDownPath, File.separator) + File.separator;
}
 
开发者ID:rocye,项目名称:wx-idk,代码行数:11,代码来源:PerpetualMediaGetRequest.java

示例13: NewsInnerImgAddRequest

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
/**
 * 构造器
 * @param fullFilePath  媒体文件路径+文件名
 */
public NewsInnerImgAddRequest(String fullFilePath) {
    this.fileName = StringUtils.substringAfterLast(fullFilePath, File.separator);
    this.filePath = StringUtils.substringBeforeLast(fullFilePath, File.separator) + File.separator;
}
 
开发者ID:rocye,项目名称:wx-idk,代码行数:9,代码来源:NewsInnerImgAddRequest.java

示例14: TempMaterialGetRequest

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
/**
 * 构造器
 * @param mediaId  		媒体文件ID
 * @param fullDownPath  下载文件路径+文件名
 */
public TempMaterialGetRequest(String mediaId, String fullDownPath) {
    this.media_id = mediaId;
    this.fileName = StringUtils.substringAfterLast(fullDownPath, File.separator);
    this.filePath = StringUtils.substringBeforeLast(fullDownPath, File.separator) + File.separator;
}
 
开发者ID:rocye,项目名称:wx-idk,代码行数:11,代码来源:TempMaterialGetRequest.java

示例15: TempMaterialAddRequest

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
/**
 * 构造器
 * @param type          媒体文件类型,分别有图片image、语音voice、视频video和缩略图thumb
 * @param fullFilePath  媒体文件路径+文件名
 */
public TempMaterialAddRequest(String type, String fullFilePath) {
    this.type = type;
    this.fileName = StringUtils.substringAfterLast(fullFilePath, File.separator);
    this.filePath = StringUtils.substringBeforeLast(fullFilePath, File.separator) + File.separator;
}
 
开发者ID:rocye,项目名称:wx-idk,代码行数:11,代码来源:TempMaterialAddRequest.java


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