public class StrSplitter extends Object
Constructor and Description |
---|
StrSplitter() |
Modifier and Type | Method and Description |
---|---|
static List<String> |
split(CharSequence str,
char separator,
boolean isTrim,
boolean ignoreEmpty)
切分字符串
|
static List<String> |
split(CharSequence str,
char separator,
int limit,
boolean isTrim,
boolean ignoreEmpty)
切分字符串,大小写敏感
|
static List<String> |
split(CharSequence text,
char separator,
int limit,
boolean isTrim,
boolean ignoreEmpty,
boolean ignoreCase)
切分字符串
|
static <R> List<R> |
split(CharSequence text,
char separator,
int limit,
boolean ignoreEmpty,
boolean ignoreCase,
Function<String,R> mapping)
切分字符串
如果为空字符串或者null 则返回空集合 |
static <R> List<R> |
split(CharSequence str,
char separator,
int limit,
boolean ignoreEmpty,
Function<String,R> mapping)
切分字符串,大小写敏感
|
static List<String> |
split(CharSequence text,
int limit)
使用空白符切分字符串
切分后的字符串两边不包含空白符,空串或空白符串并不做为元素之一 如果为空字符串或者null 则返回空集合 |
static List<String> |
split(CharSequence str,
String separator,
boolean isTrim,
boolean ignoreEmpty)
切分字符串,不忽略大小写
|
static List<String> |
split(CharSequence str,
String separator,
int limit,
boolean isTrim,
boolean ignoreEmpty)
切分字符串,不忽略大小写
|
static List<String> |
split(CharSequence text,
String separator,
int limit,
boolean isTrim,
boolean ignoreEmpty,
boolean ignoreCase)
切分字符串
如果为空字符串或者null 则返回空集合 |
static List<String> |
split(String text,
Pattern separatorPattern,
int limit,
boolean isTrim,
boolean ignoreEmpty)
通过正则切分字符串
如果为空字符串或者null 则返回空集合 |
static String[] |
splitByLength(CharSequence text,
int len)
根据给定长度,将给定字符串截取为多个部分
|
static List<String> |
splitByRegex(String text,
String separatorRegex,
int limit,
boolean isTrim,
boolean ignoreEmpty)
通过正则切分字符串
|
static List<String> |
splitIgnoreCase(CharSequence text,
char separator,
int limit,
boolean isTrim,
boolean ignoreEmpty)
切分字符串,忽略大小写
|
static List<String> |
splitIgnoreCase(CharSequence str,
String separator,
int limit,
boolean isTrim,
boolean ignoreEmpty)
切分字符串,忽略大小写
|
static List<String> |
splitPath(CharSequence str)
切分字符串路径,仅支持Unix分界符:/
|
static List<String> |
splitPath(CharSequence str,
int limit)
切分字符串路径,仅支持Unix分界符:/
|
static String[] |
splitPathToArray(CharSequence str)
切分字符串路径,仅支持Unix分界符:/
|
static String[] |
splitPathToArray(CharSequence str,
int limit)
切分字符串路径,仅支持Unix分界符:/
|
static String[] |
splitToArray(CharSequence str,
char separator,
int limit,
boolean isTrim,
boolean ignoreEmpty)
切分字符串为字符串数组
|
static String[] |
splitToArray(CharSequence str,
String separator,
int limit,
boolean isTrim,
boolean ignoreEmpty)
切分字符串为字符串数组
|
static String[] |
splitToArray(String str,
int limit)
切分字符串为字符串数组
|
static String[] |
splitToArray(String str,
Pattern separatorPattern,
int limit,
boolean isTrim,
boolean ignoreEmpty)
通过正则切分字符串为字符串数组
|
static List<String> |
splitTrim(CharSequence str,
char separator,
boolean ignoreEmpty)
切分字符串
|
static List<String> |
splitTrim(CharSequence str,
char separator,
int limit,
boolean ignoreEmpty)
切分字符串,大小写敏感,去除每个元素两边空白符
|
static List<String> |
splitTrim(CharSequence str,
String separator,
boolean ignoreEmpty)
切分字符串,去除每个元素两边空格,忽略大小写
|
static List<String> |
splitTrim(CharSequence str,
String separator,
int limit,
boolean ignoreEmpty)
切分字符串,去除每个元素两边空格,忽略大小写
|
static List<String> |
splitTrimIgnoreCase(CharSequence str,
String separator,
int limit,
boolean ignoreEmpty)
切分字符串,去除每个元素两边空格,忽略大小写
|
public static List<String> splitPath(CharSequence str)
str
- 被切分的字符串public static String[] splitPathToArray(CharSequence str)
str
- 被切分的字符串public static List<String> splitPath(CharSequence str, int limit)
str
- 被切分的字符串limit
- 限制分片数public static String[] splitPathToArray(CharSequence str, int limit)
str
- 被切分的字符串limit
- 限制分片数public static List<String> splitTrim(CharSequence str, char separator, boolean ignoreEmpty)
str
- 被切分的字符串separator
- 分隔符字符ignoreEmpty
- 是否忽略空串public static List<String> split(CharSequence str, char separator, boolean isTrim, boolean ignoreEmpty)
str
- 被切分的字符串separator
- 分隔符字符isTrim
- 是否去除切分字符串后每个元素两边的空格ignoreEmpty
- 是否忽略空串public static List<String> splitTrim(CharSequence str, char separator, int limit, boolean ignoreEmpty)
str
- 被切分的字符串separator
- 分隔符字符limit
- 限制分片数,-1不限制ignoreEmpty
- 是否忽略空串public static List<String> split(CharSequence str, char separator, int limit, boolean isTrim, boolean ignoreEmpty)
str
- 被切分的字符串separator
- 分隔符字符limit
- 限制分片数,-1不限制isTrim
- 是否去除切分字符串后每个元素两边的空格ignoreEmpty
- 是否忽略空串public static <R> List<R> split(CharSequence str, char separator, int limit, boolean ignoreEmpty, Function<String,R> mapping)
R
- 切分后的元素类型str
- 被切分的字符串separator
- 分隔符字符limit
- 限制分片数,-1不限制ignoreEmpty
- 是否忽略空串mapping
- 切分后的字符串元素的转换方法public static List<String> splitIgnoreCase(CharSequence text, char separator, int limit, boolean isTrim, boolean ignoreEmpty)
text
- 被切分的字符串separator
- 分隔符字符limit
- 限制分片数,-1不限制isTrim
- 是否去除切分字符串后每个元素两边的空格ignoreEmpty
- 是否忽略空串public static List<String> split(CharSequence text, char separator, int limit, boolean isTrim, boolean ignoreEmpty, boolean ignoreCase)
text
- 被切分的字符串separator
- 分隔符字符limit
- 限制分片数,-1不限制isTrim
- 是否去除切分字符串后每个元素两边的空格ignoreEmpty
- 是否忽略空串ignoreCase
- 是否忽略大小写public static <R> List<R> split(CharSequence text, char separator, int limit, boolean ignoreEmpty, boolean ignoreCase, Function<String,R> mapping)
R
- 切分后的元素类型text
- 被切分的字符串separator
- 分隔符字符limit
- 限制分片数,-1不限制ignoreEmpty
- 是否忽略空串ignoreCase
- 是否忽略大小写mapping
- 切分后的字符串元素的转换方法public static String[] splitToArray(CharSequence str, char separator, int limit, boolean isTrim, boolean ignoreEmpty)
str
- 被切分的字符串separator
- 分隔符字符limit
- 限制分片数isTrim
- 是否去除切分字符串后每个元素两边的空格ignoreEmpty
- 是否忽略空串public static List<String> split(CharSequence str, String separator, boolean isTrim, boolean ignoreEmpty)
str
- 被切分的字符串separator
- 分隔符字符串isTrim
- 是否去除切分字符串后每个元素两边的空格ignoreEmpty
- 是否忽略空串public static List<String> splitTrim(CharSequence str, String separator, boolean ignoreEmpty)
str
- 被切分的字符串separator
- 分隔符字符串ignoreEmpty
- 是否忽略空串public static List<String> split(CharSequence str, String separator, int limit, boolean isTrim, boolean ignoreEmpty)
str
- 被切分的字符串separator
- 分隔符字符串limit
- 限制分片数,小于等于0表示无限制isTrim
- 是否去除切分字符串后每个元素两边的空格ignoreEmpty
- 是否忽略空串public static List<String> splitTrim(CharSequence str, String separator, int limit, boolean ignoreEmpty)
str
- 被切分的字符串separator
- 分隔符字符串limit
- 限制分片数ignoreEmpty
- 是否忽略空串public static List<String> splitIgnoreCase(CharSequence str, String separator, int limit, boolean isTrim, boolean ignoreEmpty)
str
- 被切分的字符串separator
- 分隔符字符串limit
- 限制分片数isTrim
- 是否去除切分字符串后每个元素两边的空格ignoreEmpty
- 是否忽略空串public static List<String> splitTrimIgnoreCase(CharSequence str, String separator, int limit, boolean ignoreEmpty)
str
- 被切分的字符串separator
- 分隔符字符串limit
- 限制分片数ignoreEmpty
- 是否忽略空串public static List<String> split(CharSequence text, String separator, int limit, boolean isTrim, boolean ignoreEmpty, boolean ignoreCase)
text
- 被切分的字符串separator
- 分隔符字符串limit
- 限制分片数,小于等于0表示无限制isTrim
- 是否去除切分字符串后每个元素两边的空格ignoreEmpty
- 是否忽略空串ignoreCase
- 是否忽略大小写public static String[] splitToArray(CharSequence str, String separator, int limit, boolean isTrim, boolean ignoreEmpty)
str
- 被切分的字符串separator
- 分隔符字符limit
- 限制分片数,小于等于0表示无限制isTrim
- 是否去除切分字符串后每个元素两边的空格ignoreEmpty
- 是否忽略空串public static List<String> split(CharSequence text, int limit)
text
- 被切分的字符串limit
- 限制分片数public static String[] splitToArray(String str, int limit)
str
- 被切分的字符串limit
- 限制分片数public static List<String> splitByRegex(String text, String separatorRegex, int limit, boolean isTrim, boolean ignoreEmpty)
text
- 字符串separatorRegex
- 分隔符正则limit
- 限制分片数isTrim
- 是否去除切分字符串后每个元素两边的空格ignoreEmpty
- 是否忽略空串public static List<String> split(String text, Pattern separatorPattern, int limit, boolean isTrim, boolean ignoreEmpty)
text
- 字符串separatorPattern
- 分隔符正则Pattern
limit
- 限制分片数isTrim
- 是否去除切分字符串后每个元素两边的空格ignoreEmpty
- 是否忽略空串public static String[] splitToArray(String str, Pattern separatorPattern, int limit, boolean isTrim, boolean ignoreEmpty)
str
- 被切分的字符串separatorPattern
- 分隔符正则Pattern
limit
- 限制分片数isTrim
- 是否去除切分字符串后每个元素两边的空格ignoreEmpty
- 是否忽略空串public static String[] splitByLength(CharSequence text, int len)
text
- 字符串len
- 每一个小节的长度Copyright © 2024. All rights reserved.