org.apache.commons.lang3.StringUtils.splitByCharacterType()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(17.3k)|赞(0)|评价(0)|浏览(178)

本文整理了Java中org.apache.commons.lang3.StringUtils.splitByCharacterType()方法的一些代码示例,展示了StringUtils.splitByCharacterType()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。StringUtils.splitByCharacterType()方法的具体详情如下:
包路径:org.apache.commons.lang3.StringUtils
类名称:StringUtils
方法名:splitByCharacterType

StringUtils.splitByCharacterType介绍

[英]Splits a String by Character type as returned by java.lang.Character.getType(char). Groups of contiguous characters of the same type are returned as complete tokens.

StringUtils.splitByCharacterType(null)         = null 
StringUtils.splitByCharacterType("")           = [] 
StringUtils.splitByCharacterType("ab de fg")   = ["ab", " ", "de", " ", "fg"] 
StringUtils.splitByCharacterType("ab   de fg") = ["ab", "   ", "de", " ", "fg"] 
StringUtils.splitByCharacterType("ab:cd:ef")   = ["ab", ":", "cd", ":", "ef"] 
StringUtils.splitByCharacterType("number5")    = ["number", "5"] 
StringUtils.splitByCharacterType("fooBar")     = ["foo", "B", "ar"] 
StringUtils.splitByCharacterType("foo200Bar")  = ["foo", "200", "B", "ar"] 
StringUtils.splitByCharacterType("ASFRules")   = ["ASFR", "ules"]

[中]按java返回的字符类型拆分字符串。朗。性格。getType(char)。相同类型的连续字符组作为完整标记返回。

StringUtils.splitByCharacterType(null)         = null 
StringUtils.splitByCharacterType("")           = [] 
StringUtils.splitByCharacterType("ab de fg")   = ["ab", " ", "de", " ", "fg"] 
StringUtils.splitByCharacterType("ab   de fg") = ["ab", "   ", "de", " ", "fg"] 
StringUtils.splitByCharacterType("ab:cd:ef")   = ["ab", ":", "cd", ":", "ef"] 
StringUtils.splitByCharacterType("number5")    = ["number", "5"] 
StringUtils.splitByCharacterType("fooBar")     = ["foo", "B", "ar"] 
StringUtils.splitByCharacterType("foo200Bar")  = ["foo", "200", "B", "ar"] 
StringUtils.splitByCharacterType("ASFRules")   = ["ASFR", "ules"]

代码示例

代码示例来源:origin: org.apache.commons/commons-lang3

/**
 * <p>Splits a String by Character type as returned by
 * {@code java.lang.Character.getType(char)}. Groups of contiguous
 * characters of the same type are returned as complete tokens.
 * <pre>
 * StringUtils.splitByCharacterType(null)         = null
 * StringUtils.splitByCharacterType("")           = []
 * StringUtils.splitByCharacterType("ab de fg")   = ["ab", " ", "de", " ", "fg"]
 * StringUtils.splitByCharacterType("ab   de fg") = ["ab", "   ", "de", " ", "fg"]
 * StringUtils.splitByCharacterType("ab:cd:ef")   = ["ab", ":", "cd", ":", "ef"]
 * StringUtils.splitByCharacterType("number5")    = ["number", "5"]
 * StringUtils.splitByCharacterType("fooBar")     = ["foo", "B", "ar"]
 * StringUtils.splitByCharacterType("foo200Bar")  = ["foo", "200", "B", "ar"]
 * StringUtils.splitByCharacterType("ASFRules")   = ["ASFR", "ules"]
 * </pre>
 * @param str the String to split, may be {@code null}
 * @return an array of parsed Strings, {@code null} if null String input
 * @since 2.4
 */
public static String[] splitByCharacterType(final String str) {
  return splitByCharacterType(str, false);
}

代码示例来源:origin: org.apache.commons/commons-lang3

/**
 * <p>Splits a String by Character type as returned by
 * {@code java.lang.Character.getType(char)}. Groups of contiguous
 * characters of the same type are returned as complete tokens, with the
 * following exception: the character of type
 * {@code Character.UPPERCASE_LETTER}, if any, immediately
 * preceding a token of type {@code Character.LOWERCASE_LETTER}
 * will belong to the following token rather than to the preceding, if any,
 * {@code Character.UPPERCASE_LETTER} token.
 * <pre>
 * StringUtils.splitByCharacterTypeCamelCase(null)         = null
 * StringUtils.splitByCharacterTypeCamelCase("")           = []
 * StringUtils.splitByCharacterTypeCamelCase("ab de fg")   = ["ab", " ", "de", " ", "fg"]
 * StringUtils.splitByCharacterTypeCamelCase("ab   de fg") = ["ab", "   ", "de", " ", "fg"]
 * StringUtils.splitByCharacterTypeCamelCase("ab:cd:ef")   = ["ab", ":", "cd", ":", "ef"]
 * StringUtils.splitByCharacterTypeCamelCase("number5")    = ["number", "5"]
 * StringUtils.splitByCharacterTypeCamelCase("fooBar")     = ["foo", "Bar"]
 * StringUtils.splitByCharacterTypeCamelCase("foo200Bar")  = ["foo", "200", "Bar"]
 * StringUtils.splitByCharacterTypeCamelCase("ASFRules")   = ["ASF", "Rules"]
 * </pre>
 * @param str the String to split, may be {@code null}
 * @return an array of parsed Strings, {@code null} if null String input
 * @since 2.4
 */
public static String[] splitByCharacterTypeCamelCase(final String str) {
  return splitByCharacterType(str, true);
}

代码示例来源:origin: org.apache.commons/commons-lang3

@Test
public void testSplitByCharacterType() {
  assertNull(StringUtils.splitByCharacterType(null));
  assertEquals(0, StringUtils.splitByCharacterType("").length);
  assertTrue(Objects.deepEquals(new String[]{"ab", " ", "de", " ",
      "fg"}, StringUtils.splitByCharacterType("ab de fg")));
  assertTrue(Objects.deepEquals(new String[]{"ab", "   ", "de", " ",
      "fg"}, StringUtils.splitByCharacterType("ab   de fg")));
  assertTrue(Objects.deepEquals(new String[]{"ab", ":", "cd", ":",
      "ef"}, StringUtils.splitByCharacterType("ab:cd:ef")));
  assertTrue(Objects.deepEquals(new String[]{"number", "5"},
      StringUtils.splitByCharacterType("number5")));
  assertTrue(Objects.deepEquals(new String[]{"foo", "B", "ar"},
      StringUtils.splitByCharacterType("fooBar")));
  assertTrue(Objects.deepEquals(new String[]{"foo", "200", "B", "ar"},
      StringUtils.splitByCharacterType("foo200Bar")));
  assertTrue(Objects.deepEquals(new String[]{"ASFR", "ules"},
      StringUtils.splitByCharacterType("ASFRules")));
}

代码示例来源:origin: io.virtdata/virtdata-lib-realer

/**
 * <p>Splits a String by Character type as returned by
 * {@code java.lang.Character.getType(char)}. Groups of contiguous
 * characters of the same type are returned as complete tokens.
 * <pre>
 * StringUtils.splitByCharacterType(null)         = null
 * StringUtils.splitByCharacterType("")           = []
 * StringUtils.splitByCharacterType("ab de fg")   = ["ab", " ", "de", " ", "fg"]
 * StringUtils.splitByCharacterType("ab   de fg") = ["ab", "   ", "de", " ", "fg"]
 * StringUtils.splitByCharacterType("ab:cd:ef")   = ["ab", ":", "cd", ":", "ef"]
 * StringUtils.splitByCharacterType("number5")    = ["number", "5"]
 * StringUtils.splitByCharacterType("fooBar")     = ["foo", "B", "ar"]
 * StringUtils.splitByCharacterType("foo200Bar")  = ["foo", "200", "B", "ar"]
 * StringUtils.splitByCharacterType("ASFRules")   = ["ASFR", "ules"]
 * </pre>
 * @param str the String to split, may be {@code null}
 * @return an array of parsed Strings, {@code null} if null String input
 * @since 2.4
 */
public static String[] splitByCharacterType(final String str) {
  return splitByCharacterType(str, false);
}

代码示例来源:origin: io.virtdata/virtdata-lib-curves4

/**
 * <p>Splits a String by Character type as returned by
 * {@code java.lang.Character.getType(char)}. Groups of contiguous
 * characters of the same type are returned as complete tokens.
 * <pre>
 * StringUtils.splitByCharacterType(null)         = null
 * StringUtils.splitByCharacterType("")           = []
 * StringUtils.splitByCharacterType("ab de fg")   = ["ab", " ", "de", " ", "fg"]
 * StringUtils.splitByCharacterType("ab   de fg") = ["ab", "   ", "de", " ", "fg"]
 * StringUtils.splitByCharacterType("ab:cd:ef")   = ["ab", ":", "cd", ":", "ef"]
 * StringUtils.splitByCharacterType("number5")    = ["number", "5"]
 * StringUtils.splitByCharacterType("fooBar")     = ["foo", "B", "ar"]
 * StringUtils.splitByCharacterType("foo200Bar")  = ["foo", "200", "B", "ar"]
 * StringUtils.splitByCharacterType("ASFRules")   = ["ASFR", "ules"]
 * </pre>
 * @param str the String to split, may be {@code null}
 * @return an array of parsed Strings, {@code null} if null String input
 * @since 2.4
 */
public static String[] splitByCharacterType(final String str) {
  return splitByCharacterType(str, false);
}

代码示例来源:origin: io.virtdata/virtdata-lib-realer

/**
 * <p>Splits a String by Character type as returned by
 * {@code java.lang.Character.getType(char)}. Groups of contiguous
 * characters of the same type are returned as complete tokens, with the
 * following exception: the character of type
 * {@code Character.UPPERCASE_LETTER}, if any, immediately
 * preceding a token of type {@code Character.LOWERCASE_LETTER}
 * will belong to the following token rather than to the preceding, if any,
 * {@code Character.UPPERCASE_LETTER} token.
 * <pre>
 * StringUtils.splitByCharacterTypeCamelCase(null)         = null
 * StringUtils.splitByCharacterTypeCamelCase("")           = []
 * StringUtils.splitByCharacterTypeCamelCase("ab de fg")   = ["ab", " ", "de", " ", "fg"]
 * StringUtils.splitByCharacterTypeCamelCase("ab   de fg") = ["ab", "   ", "de", " ", "fg"]
 * StringUtils.splitByCharacterTypeCamelCase("ab:cd:ef")   = ["ab", ":", "cd", ":", "ef"]
 * StringUtils.splitByCharacterTypeCamelCase("number5")    = ["number", "5"]
 * StringUtils.splitByCharacterTypeCamelCase("fooBar")     = ["foo", "Bar"]
 * StringUtils.splitByCharacterTypeCamelCase("foo200Bar")  = ["foo", "200", "Bar"]
 * StringUtils.splitByCharacterTypeCamelCase("ASFRules")   = ["ASF", "Rules"]
 * </pre>
 * @param str the String to split, may be {@code null}
 * @return an array of parsed Strings, {@code null} if null String input
 * @since 2.4
 */
public static String[] splitByCharacterTypeCamelCase(final String str) {
  return splitByCharacterType(str, true);
}

代码示例来源:origin: dqeasycloud/easy-cloud

/**
 * 按照字符类型分割字符串
 * <p>Splits a String by Character type as returned by
 * <code>java.lang.Character.getType(char)</code>. Groups of contiguous
 * characters of the same type are returned as complete tokens. 
 * <pre>
 * StringUtils.splitByCharacterType(null)         = null
 * StringUtils.splitByCharacterType("")           = []
 * StringUtils.splitByCharacterType("ab de fg")   = ["ab", " ", "de", " ", "fg"]
 * StringUtils.splitByCharacterType("ab   de fg") = ["ab", "   ", "de", " ", "fg"]
 * StringUtils.splitByCharacterType("ab:cd:ef")   = ["ab", ":", "cd", ":", "ef"]
 * StringUtils.splitByCharacterType("number5")    = ["number", "5"]
 * StringUtils.splitByCharacterType("fooBar")     = ["foo", "B", "ar"]
 * StringUtils.splitByCharacterType("foo200Bar")  = ["foo", "200", "B", "ar"]
 * StringUtils.splitByCharacterType("ASFRules")   = ["ASFR", "ules"]
 * </pre>
 * @param str the String to split, may be <code>null</code>
 * @return an array of parsed Strings, <code>null</code> if null String input
 * 
 * @author daiqi
 * @date 2017年12月5日 下午8:08:37
 */
public static String [] splitByCharacterType(String str){
  return StringUtils.splitByCharacterType(str);
}

代码示例来源:origin: io.virtdata/virtdata-lib-curves4

/**
 * <p>Splits a String by Character type as returned by
 * {@code java.lang.Character.getType(char)}. Groups of contiguous
 * characters of the same type are returned as complete tokens, with the
 * following exception: the character of type
 * {@code Character.UPPERCASE_LETTER}, if any, immediately
 * preceding a token of type {@code Character.LOWERCASE_LETTER}
 * will belong to the following token rather than to the preceding, if any,
 * {@code Character.UPPERCASE_LETTER} token.
 * <pre>
 * StringUtils.splitByCharacterTypeCamelCase(null)         = null
 * StringUtils.splitByCharacterTypeCamelCase("")           = []
 * StringUtils.splitByCharacterTypeCamelCase("ab de fg")   = ["ab", " ", "de", " ", "fg"]
 * StringUtils.splitByCharacterTypeCamelCase("ab   de fg") = ["ab", "   ", "de", " ", "fg"]
 * StringUtils.splitByCharacterTypeCamelCase("ab:cd:ef")   = ["ab", ":", "cd", ":", "ef"]
 * StringUtils.splitByCharacterTypeCamelCase("number5")    = ["number", "5"]
 * StringUtils.splitByCharacterTypeCamelCase("fooBar")     = ["foo", "Bar"]
 * StringUtils.splitByCharacterTypeCamelCase("foo200Bar")  = ["foo", "200", "Bar"]
 * StringUtils.splitByCharacterTypeCamelCase("ASFRules")   = ["ASF", "Rules"]
 * </pre>
 * @param str the String to split, may be {@code null}
 * @return an array of parsed Strings, {@code null} if null String input
 * @since 2.4
 */
public static String[] splitByCharacterTypeCamelCase(final String str) {
  return splitByCharacterType(str, true);
}

代码示例来源:origin: de.knightsoft-net/gwt-commons-lang3

/**
 * <p>Splits a String by Character type as returned by
 * {@code java.lang.Character.getType(char)}. Groups of contiguous
 * characters of the same type are returned as complete tokens.
 * <pre>
 * StringUtils.splitByCharacterType(null)         = null
 * StringUtils.splitByCharacterType("")           = []
 * StringUtils.splitByCharacterType("ab de fg")   = ["ab", " ", "de", " ", "fg"]
 * StringUtils.splitByCharacterType("ab   de fg") = ["ab", "   ", "de", " ", "fg"]
 * StringUtils.splitByCharacterType("ab:cd:ef")   = ["ab", ":", "cd", ":", "ef"]
 * StringUtils.splitByCharacterType("number5")    = ["number", "5"]
 * StringUtils.splitByCharacterType("fooBar")     = ["foo", "B", "ar"]
 * StringUtils.splitByCharacterType("foo200Bar")  = ["foo", "200", "B", "ar"]
 * StringUtils.splitByCharacterType("ASFRules")   = ["ASFR", "ules"]
 * </pre>
 * @param str the String to split, may be {@code null}
 * @return an array of parsed Strings, {@code null} if null String input
 * @since 2.4
 */
@GwtIncompatible("incompatible method")
public static String[] splitByCharacterType(final String str) {
  return splitByCharacterType(str, false);
}

代码示例来源:origin: de.knightsoft-net/gwt-commons-lang3

/**
 * <p>Splits a String by Character type as returned by
 * {@code java.lang.Character.getType(char)}. Groups of contiguous
 * characters of the same type are returned as complete tokens, with the
 * following exception: the character of type
 * {@code Character.UPPERCASE_LETTER}, if any, immediately
 * preceding a token of type {@code Character.LOWERCASE_LETTER}
 * will belong to the following token rather than to the preceding, if any,
 * {@code Character.UPPERCASE_LETTER} token.
 * <pre>
 * StringUtils.splitByCharacterTypeCamelCase(null)         = null
 * StringUtils.splitByCharacterTypeCamelCase("")           = []
 * StringUtils.splitByCharacterTypeCamelCase("ab de fg")   = ["ab", " ", "de", " ", "fg"]
 * StringUtils.splitByCharacterTypeCamelCase("ab   de fg") = ["ab", "   ", "de", " ", "fg"]
 * StringUtils.splitByCharacterTypeCamelCase("ab:cd:ef")   = ["ab", ":", "cd", ":", "ef"]
 * StringUtils.splitByCharacterTypeCamelCase("number5")    = ["number", "5"]
 * StringUtils.splitByCharacterTypeCamelCase("fooBar")     = ["foo", "Bar"]
 * StringUtils.splitByCharacterTypeCamelCase("foo200Bar")  = ["foo", "200", "Bar"]
 * StringUtils.splitByCharacterTypeCamelCase("ASFRules")   = ["ASF", "Rules"]
 * </pre>
 * @param str the String to split, may be {@code null}
 * @return an array of parsed Strings, {@code null} if null String input
 * @since 2.4
 */
@GwtIncompatible("incompatible method")
public static String[] splitByCharacterTypeCamelCase(final String str) {
  return splitByCharacterType(str, true);
}

代码示例来源:origin: org.xworker/xworker_core

public static String[] splitByCharacterType(ActionContext actionContext){
  Thing self = actionContext.getObject("self");
  String str  = (String) self.doAction("getStr", actionContext);
  return StringUtils.splitByCharacterType(str);
}

代码示例来源:origin: micromata/projectforge

final String str[] = StringUtils.splitByCharacterType(strLine);

相关文章

StringUtils类方法