本文整理汇总了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;
}
示例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;
}
示例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])"
// ),
// " "
// );
}
示例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;
}
示例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();
}