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


Java StringUtils.splitByCharacterTypeCamelCase方法代码示例

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


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

示例1: convert

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
/**
 * Convert the literal into natural language.
 * 
 * @param lit
 *            the literal
 * @return the natural language expression
 */
public String convert(LiteralLabel lit) {
	logger.debug("Literal to be converted" + lit.toString());
	
	RDFDatatype dt = lit.getDatatype();
	
	String s = lit.getLexicalForm();
	if (dt == null || dt instanceof RDFLangString) {// plain literal, i.e.
													// omit language tag if
													// exists
		s = lit.getLexicalForm();
		s = s.replaceAll("_", " ");
		s = s.replace('*', ' ');
		s = s.trim();
		if (encapsulateStringLiterals) {
			s = '"' + s + '"';
		}
	} else {// typed literal
		if (dt instanceof XSDDatatype) {// built-in XSD datatype
			if (dt instanceof XSDAbstractDateTimeType) {// date datetypes
				s = convertDateLiteral(lit);
			} else if (encapsulateStringLiterals && dt.equals(XSDDatatype.XSDstring)) {
				s = s.replace('*', ' ');
				s = s.trim();
				s = '"' + s + '"';
			}
		} else {// user-defined datatype
			String text = iriConverter.convert(dt.getURI(), false).toLowerCase();
			String[] split = StringUtils.splitByCharacterTypeCamelCase(text.trim());
			String datatype = Joiner.on(" ").join(Arrays.asList(split).stream().filter(str -> !str.trim().isEmpty())
					.collect(Collectors.toList()));
			s = lit.getLexicalForm() + " " + datatype;
		}
	}
	return s;
}
 
开发者ID:dice-group,项目名称:RDF2PT,代码行数:43,代码来源:LiteralConverterPortuguese.java

示例2: convert

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
/**
 * Convert the literal into natural language.
 * @param lit the literal
 * @return the natural language expression
 */
public String convert(LiteralLabel lit) {
    RDFDatatype dt = lit.getDatatype();

    String s = lit.getLexicalForm();
    if (dt == null || dt instanceof RDFLangString) {// plain literal, i.e. omit language tag if exists
        s = lit.getLexicalForm();
        s = s.replaceAll("_", " ");
        if(encapsulateStringLiterals){
        	s = '"' + s + '"';
        }
    } else {// typed literal
        if (dt instanceof XSDDatatype) {// built-in XSD datatype
        	if(dt instanceof XSDAbstractDateTimeType){//date datetypes
        		s = convertDateLiteral(lit);
        	} else if(encapsulateStringLiterals && dt.equals(XSDDatatype.XSDstring)){
	s = '"' + s + '"';
}
        } else {// user-defined datatype
String text = iriConverter.convert(dt.getURI(), false).toLowerCase();
String[] split = StringUtils.splitByCharacterTypeCamelCase(text.trim());
String datatype = Joiner.on(" ").join(Arrays.asList(split).stream().filter(str -> !str.trim().isEmpty()).collect(Collectors.toList()));
s = lit.getLexicalForm() + " " + datatype;
        }
    }
    return s;
}
 
开发者ID:dice-group,项目名称:RDF2PT,代码行数:32,代码来源:LiteralConverter.java

示例3: splitCamelCase

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
private String splitCamelCase(String s) {
		// we only split if it contains a vowel
		if(!(s.matches(".*[aeiou].*"))){
			return s;
		}
		
		StringBuilder sb = new StringBuilder();
		for (String token : s.split(" ")) {
			String[] tokenSplit = StringUtils.splitByCharacterTypeCamelCase(token);
			
			String noVowels = "";
			for (String t : tokenSplit) {
				if(t.matches(".*[aeiou].*") || !StringUtils.isAllUpperCase(t)){
					if(!noVowels.isEmpty()){
						sb.append(noVowels).append(" ");
						noVowels = "";
					}
					sb.append(t).append(" ");
				} else {
					noVowels += t;
				}
//				sb = new StringBuilder(sb.toString().trim());
			}
			sb.append(noVowels);
//			sb.append(" ");
		}
		return sb.toString().trim();
		//	    	return s.replaceAll(
		//	    	      String.format("%s|%s|%s",
		//	    	         "(?<=[A-Z])(?=[A-Z][a-z])",
		//	    	         "(?<=[^A-Z])(?=[A-Z])",
		//	    	         "(?<=[A-Za-z])(?=[^A-Za-z])"
		//	    	      ),
		//	    	      " "
		//	    	   );
	}
 
开发者ID:dice-group,项目名称:RDF2PT,代码行数:37,代码来源:SimpleIRIConverter.java

示例4: convert

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
/**
 * Convert the literal into natural language.
 * 
 * @param lit
 *            the literal
 * @return the natural language expression
 */
public String convert(LiteralLabel lit) {
	RDFDatatype dt = lit.getDatatype();

	String s = lit.getLexicalForm();
	if (dt == null || dt instanceof RDFLangString) {// plain literal, i.e.
													// omit language tag if
													// exists
		s = lit.getLexicalForm();
		s = s.replaceAll("_", " ");
		if (encapsulateStringLiterals) {
			s = '"' + s + '"';
		}
	} else {// typed literal
		if (dt instanceof XSDDatatype) {// built-in XSD datatype
			if (dt instanceof XSDAbstractDateTimeType) {// date datetypes
				s = convertDateLiteral(lit);
			} else if (encapsulateStringLiterals && dt.equals(XSDDatatype.XSDstring)) {
				s = '"' + s + '"';
			}
		} else {// user-defined datatype
			String text = iriConverter.convert(dt.getURI(), false).toLowerCase();
			String[] split = StringUtils.splitByCharacterTypeCamelCase(text.trim());
			String datatype = Joiner.on(" ").join(Arrays.asList(split).stream().filter(str -> !str.trim().isEmpty())
					.collect(Collectors.toList()));
			s = lit.getLexicalForm() + " " + datatype;
		}
	}
	return s;
}
 
开发者ID:dice-group,项目名称:RDF2PT,代码行数:37,代码来源:LiteralConverterFrench.java

示例5: readableHandlerName

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
private String readableHandlerName(final LifecycleHandler handler) {
    val words = StringUtils.splitByCharacterTypeCamelCase(handler.getClass().getSimpleName());
    return String.join(" ", words).toLowerCase();
}
 
开发者ID:fabzo,项目名称:kraken,代码行数:5,代码来源:Environment.java


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