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


Java StringUtils.substringBetween方法代码示例

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


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

示例1: getColumnLengthAndPrecision

import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
public static int[] getColumnLengthAndPrecision(Column column){
	int[] ret = new int[2];
	String data = StringUtils.substringBetween(column.getMysqlType(), "(",")");
	String length = StringUtils.substringBefore(data, ",");
	String precision = StringUtils.substringAfter(data, ",");
	String type = getColumnType(column).toUpperCase();
	if("SET".equals(type) || "ENUM".equals(type)){
		ret[0] = 0;
		ret[1] = 0;
	}else{
		if(StringUtils.isEmpty(length)){
			ret[0] = 0;
		}else{
			ret[0] = Integer.parseInt(length);
		}
		if(StringUtils.isEmpty(precision)){
			ret[1] = 0;
		}else{
			ret[1] = Integer.parseInt(precision);
		}
	}
	return ret;
}
 
开发者ID:BriData,项目名称:DBus,代码行数:24,代码来源:Support.java

示例2: subHexArray

import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
/**
 * 根据hex文本数组截取数据,返回截获的hex数组
 * @param data 类型:[0, 7, -63, -108]
 * @param startHexStr 类型:["0C", "B6", "05", "00"]
 * @param endHexStr 类型:["0C", "B6", "05", "00"]
 * @return 类型:["0C", "B6", "05", "00"] 失败返回null
 */
public String[] subHexArray(byte[] data,String[] startHexStr,String[] endHexStr)
{
	if(data==null||data.length<=0)
	{
		System.out.println("data数据无效!");
		return null;
	}
	String[] result=null;
	String[] hexarray=toHexArray(data);
	String hexstr=Arrays.toString(hexarray);
	hexstr=StringUtils.substringBetween(hexstr, "[", "]").replaceAll("\\s", "");//原数据字符串去括号空格
	String start=Arrays.toString(startHexStr);//转换为字符串
	start=StringUtils.substringBetween(start, "[", "]").replaceAll("\\s", "");//去括号空格
	String end=Arrays.toString(endHexStr);
	end=StringUtils.substringBetween(end, "[", "]").replaceAll("\\s", "");//去括号空格
	String resultHex=StringUtils.substringBetween(hexstr, start, end);//取中间数据
	if(resultHex==null)
	{
		//System.out.println("注意:截取内容为空,无数据!");
		return null;
	}
	result=StringUtils.split(resultHex, ',');//重组为hexstr数组
	return result;
}
 
开发者ID:juebanlin,项目名称:util4j,代码行数:32,代码来源:HexStrBytes.java

示例3: SubHexArrays

import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
/**
 * 失败返回null
 * 根据hex字符数组截取数据,返回截获数据的hex数组
 * @param data 类型:[0, 7, -63, -108]
 * @param startHexStr 类型:["0C", "B6", "05", "00"]
 * @param endHexStr 类型:["0C", "B6", "05", "00"]
 * @return 类型:["0C", "B6", "05", "00"]
 */
public String[] SubHexArrays(byte[] data,String[] startHexStr,String[] endHexStr)
{
	if(data==null||data.length<=0)
	{
		System.out.println("data数据无效!");
		return null;
	}
	String[] result=null;
	String[] hexarray=byteArrayToHexArray(data);
	String hexstr=Arrays.toString(hexarray);
	hexstr=StringUtils.substringBetween(hexstr, "[", "]").replaceAll("\\s", "");//原数据字符串去括号空格
	String start=Arrays.toString(startHexStr);//转换为字符串
	start=StringUtils.substringBetween(start, "[", "]").replaceAll("\\s", "");//去括号空格
	String end=Arrays.toString(endHexStr);
	end=StringUtils.substringBetween(end, "[", "]").replaceAll("\\s", "");//去括号空格
	String resultHex=StringUtils.substringBetween(hexstr, start, end);//取中间数据
	if(resultHex==null)
	{
		//System.out.println("注意:截取内容为空,无数据!");
		return null;
	}
	result=StringUtils.split(resultHex, ',');//重组为hexstr数组
	return result;
}
 
开发者ID:juebanlin,项目名称:util4j,代码行数:33,代码来源:DataTools.java

示例4: getRootElementName

import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
private String getRootElementName(String rowTag) {

		String rootElementName = null;

		if (StringUtils.isBlank(rowTag) || !rowTag.startsWith("/")) {
			return null;
		}

		// TODO: Ask for requirement how row tag will be come
		if (rowTag.startsWith("/")) {
			rootElementName = StringUtils.substringBetween(rowTag, "/", "/");
		}
		if (StringUtils.isBlank(rootElementName)) {
			rootElementName = StringUtils.substringAfter(rowTag, "/");
		}

		return rootElementName;
	}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:19,代码来源:ExportXSDWidget.java

示例5: getParamValue

import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
/**
	 * 
	 * checking the parameter in paramsMap
	 * @param value
	 * @return value of Parameter if found in Map otherwise Parameter not found
	 */
 public String getParamValue(String value){
	 Optional<String> optional = Optional.of(value);
	 if(jobProps != null && !jobProps.isEmpty() && optional.isPresent() && value.contains("@{")){
		String param = "";
		String[] splitString = value.split("/");
		for(String field : splitString){
			if(field.startsWith("@{")){
				field = StringUtils.substringBetween(field, "@{", "}");
				for (Map.Entry<String, String> entry : paramsMap.entrySet()){
					if(StringUtils.equals(entry.getKey(), field)){
						if(entry.getValue().endsWith("/")){
							param = param == null ? entry.getValue() : param.concat(entry.getValue() + "/");
						}
						param = param == null ? entry.getValue() : param.concat(entry.getValue() + "/");
					}
				}
			}else{
				param += field + "/";
			}
		}
		return getResult(param);
	}
		return PARAMETER_NOT_FOUND;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:31,代码来源:Utils.java

示例6: getWorkflowIdAndKeyFromUrl

import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
public static Pair<String, String> getWorkflowIdAndKeyFromUrl(String url)
{
    //url example: http://localhost:8081/share/page/reset-password?key=164e37bf-2590-414e-94db-8b8cfe5be790&id=activiti$156
    assertNotNull(url);

    String id = StringUtils.trimToNull(
                StringUtils.substringAfter(url, "id="));
    String key = StringUtils.substringBetween(url, "key=", "&id=");

    Pair<String, String> pair = new Pair<>(id, key);
    return pair;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:13,代码来源:ResetPasswordServiceImplTest.java

示例7: toHexStr

import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
/**
 * 将一个装有16进制的string数组变成一个16进制字符串
 * "[01, 16, 1F, 0E]" ==> 01161F0E
 * @param hexStringArray
 * @return
 */
public String toHexStr(String[] hexStringArray)
{
	String hexStr=Arrays.toString(hexStringArray);
	hexStr=StringUtils.substringBetween(hexStr, "[", "]");
	hexStr=hexStr.replaceAll("\\s", "");//去空格
	hexStr=hexStr.replaceAll(",", "");
	return hexStr;
}
 
开发者ID:juebanlin,项目名称:util4j,代码行数:15,代码来源:HexStrBytes.java

示例8: toHexStrArray

import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
/**
 * 将一个16进制文本数组字符串转为16进制文本数组
 * "[01, 16, 1F, 0E]" ==> [01, 16, 1F, 0E]
 * @param hexArrayStr
 * @return
 */
public String[] toHexStrArray(String hexArrayStr)
{
	String hexStr=StringUtils.substringBetween(hexArrayStr, "[", "]");
	hexStr=hexStr.replaceAll("\\s", "");//去空格
	String[] hexStrArray=hexStr.split(",");
	return hexStrArray;
}
 
开发者ID:juebanlin,项目名称:util4j,代码行数:14,代码来源:HexStrBytes.java

示例9: hexStringArrayToHexStr

import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
/**
 * 将数组形式的16进制文本替换为普通文本
 * @param str
 * @return
 */
public String hexStringArrayToHexStr(String[] str)
{
	String hexStr=Arrays.toString(str);
	hexStr=StringUtils.substringBetween(hexStr, "[", "]");
	hexStr=hexStr.replaceAll("\\s", "");//去空格
	hexStr=hexStr.replaceAll(",", "");
	return hexStr;
}
 
开发者ID:juebanlin,项目名称:util4j,代码行数:14,代码来源:DataTools.java

示例10: getLongDescription

import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
private String getLongDescription(String templateString) {
    String longDescription = panel.getLongDescription();
    // Get the empty Spaces in templates in new Line and the longDescription Variable
    String searchString = "${" + Consts.LONG_DESCRIPTION + "}";
    String emptySpaces =
            StringUtils.substringBetween(templateString, identifyLineDelimiter(templateString), searchString);
    String lineDelimiter = identifyLineDelimiter(longDescription);
    return StringUtils.replace(longDescription, lineDelimiter, lineDelimiter + emptySpaces).trim();
}
 
开发者ID:JanGatting,项目名称:GitCommitMessage,代码行数:10,代码来源:PanelDialog.java

示例11: main

import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
public static void main(String[] args){
	String str="int";
	String length = StringUtils.substringBetween(str, "(",")");
	String precision = StringUtils.substringBefore(length, ",");
	String scale = StringUtils.substringAfter(length, ",");
}
 
开发者ID:BriData,项目名称:DBus,代码行数:7,代码来源:Support.java

示例12: retrieve

import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
@Override
   public Object retrieve(IDataSource snDataSource, Object object) throws RetrieverException {
                               
       HttpClient client = (HttpClient)snDataSource.connect();
       
       // We should use an encoded query in this case because URL parameters do not support the full semantics of a filter.        
       String serviceUrl     = AppProperties.getProperty("service_url");
       String restPath       = AppProperties.getProperty("rest_path");
       String resultLimit    = AppProperties.getProperty("result_limit");
       String period_of_time = AppProperties.getProperty("period_of_time");
       String url1           = "?sysparm_query=active%3Dtrue%5Estate!%3D6%5Esys_created_onRELATIVEGE%40hour%40ago%40" + period_of_time;
       String url2           = "%5Eassignment_group%3D81db147e2b5c79444dde23f119da153b&sysparm_display_value=true&sysparm_fields=sys_id%2Cnumber%2Cshort_description%2Cdescription&sysparm_limit=" + resultLimit;
       
       String finalUrl = serviceUrl + restPath + url1 + url2;
       
       HttpMethod method = new GetMethod(finalUrl);
       method.addRequestHeader("Accept", "application/json");
       String message = "";
       try {
           int status = client.executeMethod(method);
           log.info("Status:" + status);
           BufferedReader rd = new BufferedReader(new InputStreamReader(method.getResponseBodyAsStream()));     
           message = org.apache.commons.io.IOUtils.toString(rd);
       } catch (IOException ioe) {
           throw new RetrieverException(ioe.toString());
       }
       
       // remove leading and ending "{"
       int index = message.indexOf("\"result\":");
       message = message.substring(index+9, message.length()-1);
       
Gson gson = new Gson(); 
       ServiceNowTicket[] wrapper = null;
       try {
           wrapper = gson.fromJson(message, ServiceNowTicket[].class);   
       } catch (Exception e) {
           log.error(e.toString());
       }
       
       if (wrapper == null) {
           log.error("Problem retrieving information from ServiceNow");
           return null;
       }
       log.info("number of fetched tickets: " + wrapper.length);
       List<ServiceNowTicket> ticketList = Arrays.asList(wrapper);  
       
       for (Iterator<ServiceNowTicket> it = ticketList.iterator(); it.hasNext();) {
           ServiceNowTicket ticket = it.next();
           log.info("Fetching IP address and date");
           String source    = StringUtils.substringBetween(ticket.getDescription(), "<Source>", "</Source>");
           String timeStamp = StringUtils.substringBetween(source, "<TimeStamp>", "</TimeStamp>");
           String ipAddress = StringUtils.substringBetween(source, "<IP_Address>", "</IP_Address>");
           log.info("--------------------------");
           log.info("Sys_Id:    " + ticket.getSysId());
           log.info("Number:    " + ticket.getNumber());
           log.info("Timestamp: " + timeStamp);
           log.info("IPAddress: " + ipAddress);      
           log.info("--------------------------");
           log.info("");
           ClaimService service = new ClaimService();
           try {
               // fixing timestamp
               timeStamp = fixTimeStampFormat(timeStamp);
               
               // Sends data to ElasticSearch to find CWL
               IDataSource esDataSource = new ElasticSearchDataSource();
               esDataSource.connect();
               
               // Sends data to CWL database to find email address, first and last name
               
               
               
               
               // save data in the database
               service.addTicket(ticket.getNumber(), ticket.getDescription(), java.sql.Timestamp.valueOf(timeStamp), ipAddress);
           } catch (Exception de) {
               log.error(de.toString());
           }
       }
       return null;
   }
 
开发者ID:armenak,项目名称:uDetective,代码行数:82,代码来源:ServiceNowRetriever.java

示例13: getDecodedAuthnRequest

import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
private String getDecodedAuthnRequest(final String content) throws Exception {
    assertTrue(content.contains("<form"));
    final String samlRequestField = StringUtils.substringBetween(content, "SAMLRequest", "</div");
    final String value = StringUtils.substringBetween(samlRequestField, "value=\"", "\"");
    return new String(Base64.getDecoder().decode(value), HttpConstants.UTF8_ENCODING);
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:7,代码来源:PostSAML2ClientTests.java


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