當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。