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


Java StringUtils.split方法代码示例

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


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

示例1: getConfigIdList

import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
/**
 * 返回指定搜索的配置ID列表
 *
 * @return
 */
public List<Long> getConfigIdList() {
    if (StringUtils.isEmpty(configId)) {
        return Collections.emptyList();
    } else {
        List<Long> configIdList = new ArrayList<>();
        for (String str : StringUtils.split(this.configId)) {
            try {
                configIdList.add(Long.valueOf(str));
            } catch (Exception e) {
                // Ingore
            }
        }
        return configIdList;
    }
}
 
开发者ID:zouzhirong,项目名称:configx,代码行数:21,代码来源:ConfigSearchForm.java

示例2: isAtLeast

import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
@Override
public boolean isAtLeast(String atLeast) {
    if (StringUtils.isBlank(atLeast)) {
        return true;
    }

    String[] versionTokens = StringUtils.split(version, ".");
    String[] otherVersionTokens = StringUtils.split(atLeast, ".");
    for (int tokenIndex = 0; tokenIndex < otherVersionTokens.length; tokenIndex++) {
        String atLeastToken = otherVersionTokens[tokenIndex].trim();
        String versionToken = versionTokens.length < (tokenIndex + 1) ? "0" : versionTokens[tokenIndex].trim();
        int comparison = compareTokens(versionToken, atLeastToken);
        if (comparison != 0) {
            return comparison > 0;
        }
    }
    return true;
}
 
开发者ID:JFrogDev,项目名称:jfrog-idea-plugin,代码行数:19,代码来源:VersionImpl.java

示例3: subByteArrays

import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
public byte[] subByteArrays(byte[] data,byte[] startArray)
	{
		if(data==null||data.length<=0)
		{
			System.out.println("data参数错误!");
			return null;
		}
		String[] dataHex=byteArrayToHexArray(data);//转换为hex字符数组
		String dataHexStr=Arrays.toString(dataHex);//转换为hex字符串
		dataHexStr=StringUtils.substringBetween(dataHexStr, "[", "]").replaceAll("\\s", "");//去括号空格
		
		String[] startHex=byteArrayToHexArray(startArray);//转换为hex字符数组
		String startHexStr=Arrays.toString(startHex);//转换为hex字符串
		startHexStr=StringUtils.substringBetween(startHexStr, "[", "]").replaceAll("\\s", "");//去括号空格
		String resultHex=StringUtils.substringAfter(dataHexStr, startHexStr);//截取并转换为hex字符串
		if(resultHex==null)
		{
			//System.out.println("注意:截取内容为空,无数据!");
			return null;
		}
		String[] result=StringUtils.split(resultHex, ',');//重组为hexstr数组
//		System.out.println(Arrays.toString(result));
		return hexArrayToBtyeArray(result);
	}
 
开发者ID:juebanlin,项目名称:util4j,代码行数:25,代码来源:DataTools.java

示例4: TestEndpoint

import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
/**
 * Test if custom endpoint is picked up.
 * <p/>
 * The test expects TEST_ENDPOINT to be defined in the Configuration
 * describing the endpoint of the bucket to which TEST_FS_S3A_NAME points
 * (f.i. "s3-eu-west-1.amazonaws.com" if the bucket is located in Ireland).
 * Evidently, the bucket has to be hosted in the region denoted by the
 * endpoint for the test to succeed.
 * <p/>
 * More info and the list of endpoint identifiers:
 * http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region
 *
 * @throws Exception
 */
@Test
public void TestEndpoint() throws Exception {
  conf = new Configuration();
  String endpoint = conf.getTrimmed(TEST_ENDPOINT, "");
  if (endpoint.isEmpty()) {
    LOG.warn("Custom endpoint test skipped as " + TEST_ENDPOINT + "config " +
        "setting was not detected");
  } else {
    conf.set(Constants.ENDPOINT, endpoint);
    fs = S3ATestUtils.createTestFileSystem(conf);
    AmazonS3Client s3 = fs.getAmazonS3Client();
    String endPointRegion = "";
    // Differentiate handling of "s3-" and "s3." based endpoint identifiers
    String[] endpointParts = StringUtils.split(endpoint, '.');
    if (endpointParts.length == 3) {
      endPointRegion = endpointParts[0].substring(3);
    } else if (endpointParts.length == 4) {
      endPointRegion = endpointParts[1];
    } else {
      fail("Unexpected endpoint");
    }
    assertEquals("Endpoint config setting and bucket location differ: ",
        endPointRegion, s3.getBucketLocation(fs.getUri().getHost()));
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:40,代码来源:TestS3AConfiguration.java

示例5: parseEntityReference

import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
public boolean parseEntityReference(String reference, Reference ref) {
    if (reference.startsWith(REFERENCE_ROOT)) {
        if (log.isDebugEnabled()) log.debug("kaltura EP.parseEntityReference(reference="+reference+", ref="+ref+")");
        String[] parts = StringUtils.split(reference, Entity.SEPARATOR);

        String subType = REFERENCE_SUB_TYPE;
        String context = null;
        String id = null;
        String container = "";
        if (parts.length > 1) {
            String type = parts[1];
            if ("collection".equals(type) && parts.length > 2) {
                // assume /kaltura/collection/collectionid
                id = parts[2];
                MediaCollection mc = service.getCollection(id, 0, 0);
                if (mc != null) {
                    context = mc.getLocationId();
                }
                ref.set("kaltura", subType, id, container, context);
                if (log.isDebugEnabled()) log.debug("kaltura EP.parseEntityReference: TRUE context="+context+", ref="+ref);
                return true;
            }
            // handle other types?
        }
        if (log.isDebugEnabled()) log.debug("kaltura EP.parseEntityReference: FALSE");
    }
    return false;
}
 
开发者ID:ITYug,项目名称:kaltura-ce-sakai-extension,代码行数:29,代码来源:KalturaEntityProducer.java

示例6: getPrimaryKeyColumnFields

import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
private TypePrimaryKeys getPrimaryKeyColumnFields(String primaryKeyFeilds) {
	TypePrimaryKeys primaryKeys = new TypePrimaryKeys();
	String[] primaryKeyColumnsFields = StringUtils.split(primaryKeyFeilds, Constants.LOAD_TYPE_NEW_TABLE_VALUE_SEPERATOR);
	if(primaryKeyColumnsFields !=null && primaryKeyColumnsFields.length>0){
		TypeKeyFields primaryTypeKeyFields = new TypeKeyFields();
		primaryKeys.setPrimaryKeys(primaryTypeKeyFields);
		for(String fieldValue : primaryKeyColumnsFields){
			TypeFieldName primaryTypeFieldName = new TypeFieldName();
			primaryTypeFieldName.setName(fieldValue);
			primaryTypeKeyFields.getField().add(primaryTypeFieldName);
		}
	}
			
	return primaryKeys;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:16,代码来源:OutputSparkRedshiftConverter.java

示例7: parsePatternString

import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
private static List<MutationElem> parsePatternString(
		DrugClass drugClass, String pattern) {
	List<MutationElem> mutElements = new ArrayList<>();
	String[] mutArr = StringUtils.split(pattern, ',');
	Gene gene = drugClass.gene();
	for (int i=0; i < mutArr.length; i++) {
		Matcher mm = mutationRegex.matcher(mutArr[i]);
		mm.find();
		int pos = Integer.parseInt(mm.group(2));
		String aa = mm.group(3);
		MutationElem mutElem = new MutationElem(gene, pos, aa);
		mutElements.add(mutElem);
	}
	return mutElements;
}
 
开发者ID:hivdb,项目名称:sierra,代码行数:16,代码来源:MutationPatternScoresExporter.java

示例8: decryptToken

import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
@Override
public ISSOToken decryptToken(String tokenSeriStr) throws Exception {
    if (StringUtils.isNotBlank(tokenSeriStr)) {
        String _userAgent = WebContext.getRequest().getHeader("User-Agent");
        String[] _tokenArr = StringUtils.split(WebUtils.decryptStr(tokenSeriStr, _userAgent), "|");
        if (_tokenArr != null && _tokenArr.length == 2) {
            return new DefaultSSOToken(_tokenArr[0], _userAgent, null, BlurObject.bind(_tokenArr[1]).toLongValue()).build();
        }
    }
    return null;
}
 
开发者ID:suninformation,项目名称:ymate-module-sso,代码行数:12,代码来源:DefaultSSOTokenAdapter.java

示例9: getAndCheckStorageTypes

import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
private List<StorageType> getAndCheckStorageTypes(String types) {
  if ("".equals(types) || "all".equalsIgnoreCase(types)) {
    return StorageType.getTypesSupportingQuota();
  }

  String[] typeArray = StringUtils.split(types, ',');
  List<StorageType> stTypes = new ArrayList<>();

  for (String t : typeArray) {
    stTypes.add(StorageType.parseStorageType(t));
  }

  return stTypes;
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:15,代码来源:Count.java

示例10: query

import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
@POST
@Consumes(MediaType.APPLICATION_JSON)
@Path("/query")
@ApiOperation(
    value = "Send a general query",
    response = Map.class,
    responseContainer = "List")
public Response query(EsQuery esQuery) {

  OperationStats opStats = new OperationStats("cmdb_api", "query", new HashMap<>());
  Map<String, String> tags = new HashMap<>();

  String queryString = esQuery.getQueryString();
  String fields = esQuery.getFields();

  try {

    // Metrics tags
    tags.put("status", String.valueOf(Response.Status.OK.getStatusCode()));
    opStats.succeed(tags);

    logger.info("Success: query - {}", queryString);

    String[] includeFields = StringUtils.split(fields, ",");
    Iterator<EsQueryResult> output = cmdbInstanceStore.query(queryString, includeFields);
    // Process iterator items one by one instead of converting to list
    List<Map<String, Object>> results = generateFlatOutput(output, includeFields);
    return Response.status(Response.Status.OK)
        .type(MediaType.APPLICATION_JSON)
        .entity(results)
        .build();

  } catch (Exception e) {
    return Utils.responseException(e, logger, opStats, tags);

  }

  // End of query function
}
 
开发者ID:pinterest,项目名称:soundwave,代码行数:40,代码来源:Query.java

示例11: SubHexArraysByStr

import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
/**
 * 截取以什么开头的数据
 * @param data
 * @param startHexStr
 * @return
 * @throws UnsupportedEncodingException
 */
public String[] SubHexArraysByStr(byte[] data,String startStr) throws UnsupportedEncodingException
{
	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", "");//原数据字符串去括号空格
	////转换匹配参数数据
	byte[] startArray=startStr.getBytes("utf-8");//转换为字节
	String[] startHex=byteArrayToHexArray(startArray);//转换为hex字符数组
	String startHexStr=Arrays.toString(startHex);//转换为hex字符串
	startHexStr=StringUtils.substringBetween(startHexStr, "[", "]").replaceAll("\\s", "");//去括号空格
	String resultHex=StringUtils.substringAfter(hexstr, startHexStr);
	if(resultHex==null)
	{
		//System.out.println("注意:截取内容为空,无数据!");
		return null;
	}
	result=StringUtils.split(resultHex, ',');//重组为hexstr数组
	return result;
}
 
开发者ID:juebanlin,项目名称:util4j,代码行数:34,代码来源:DataTools.java

示例12: isAlias

import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
/**
 * 判断名字是否是别名
 *
 * @param env
 * @param name
 * @return
 */
private boolean isAlias(Env env, String name) {
    if (StringUtils.isEmpty(env.getAlias())) {
        return false;
    }
    String[] aliases = StringUtils.split(env.getAlias(), ",");
    for (String alias : aliases) {
        if (alias != null && alias.equalsIgnoreCase(name)) {
            return true;
        }
    }
    return false;
}
 
开发者ID:zouzhirong,项目名称:configx,代码行数:20,代码来源:EnvService.java

示例13: startsWithParameter

import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
/**
 * Returns true if input string starts with parameter.
 * 
 * @param path
 * @param separator
 * @return
 */
public static boolean startsWithParameter(String path,char separator) {
	String pathSegments[]=StringUtils.split(path, separator);
	if(isParameter(pathSegments[0])){
			return true;
	}
	return false;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:15,代码来源:ParameterUtil.java

示例14: PullProcessorIndex

import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
/**
 * Creates the index and reads the meta-data
 */
public PullProcessorIndex() {
  super();
  indexName = xmlStreamReader.getAttributeValue(XmlDataSetNode.URI, XmlDataSetNode.NAME_ATTRIBUTE);
  isUnique = Boolean.parseBoolean(xmlStreamReader.getAttributeValue(XmlDataSetNode.URI, XmlDataSetNode.UNIQUE_ATTRIBUTE));

  String columnsNamesCombined = xmlStreamReader.getAttributeValue(XmlDataSetNode.URI, XmlDataSetNode.COLUMNS_ATTRIBUTE);

  for (String columnName : StringUtils.split(columnsNamesCombined, ",")) {
    columnNames.add(columnName.trim());
  }
}
 
开发者ID:alfasoftware,项目名称:morf,代码行数:15,代码来源:XmlDataSetProducer.java

示例15: validate

import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
@Override
public boolean validate(Object object, String propertyName, Map<String, List<FixedWidthGridRow>> inputSchemaMap,
		boolean isJobFileImported) {
	if (object != null) {
		List<String> tmpList = new LinkedList<>();
		Map<String, Object> keyFieldsList = (LinkedHashMap<String, Object>) object;
		
		if (keyFieldsList != null && !keyFieldsList.isEmpty()&& keyFieldsList.containsKey(Constants.LOAD_TYPE_NEW_TABLE_KEY)) {
			if(inputSchemaMap != null){
				for(java.util.Map.Entry<String, List<FixedWidthGridRow>> entry : inputSchemaMap.entrySet()){
					List<FixedWidthGridRow> gridRowList = entry.getValue();
					gridRowList.forEach(gridRow -> tmpList.add(gridRow.getFieldName()));
				}
			}
			for(Entry<String, Object> grid: keyFieldsList.entrySet()){
			    String[] keyValues = StringUtils.split((String) grid.getValue(), ",");
			    for(String values : keyValues){
			    	if(!tmpList.contains(values)){
			    		errorMessage = "Target Fields Should be present in Available Fields";
						return false;
			    	}
			    }
			}
			
			return true;
		}else if(keyFieldsList != null && !keyFieldsList.isEmpty() && keyFieldsList.containsKey(Constants.LOAD_TYPE_INSERT_KEY)){
			return true;
		}else if(keyFieldsList != null && !keyFieldsList.isEmpty() && keyFieldsList.containsKey(Constants.LOAD_TYPE_REPLACE_KEY)){
			return true;
		}
	}
	return true;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:34,代码来源:DatabaseKeyValidation.java


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