public final class Strings extends Object
| 构造器和说明 |
|---|
Strings() |
| 限定符和类型 | 方法和说明 |
|---|---|
static String |
concatSqlLike(String str) |
static String |
concatUrlPath(String prefixPath,
String suffixPath)
拼接两个路径,以“/”开头,不以“/”结尾
e.g.: concatUrlPath("/a", "/b/c") -> /a/b/c
|
static boolean |
containsAny(String str,
List<String> searches) |
static boolean |
isMatch(String s,
String p)
'?'
|
static String |
of(byte[] bytes,
Charset charset) |
static String |
requireNonBlank(String str) |
static String |
substringAfterLast(String str,
String separator)
substringAfterLast(null, "
|
static String |
toCamelcaseFormat(String separatedFormat,
char separator)
带分隔符名字转驼峰,如下划线转换为驼峰:CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, underscoreName);
1、LOWER_HYPHEN -> 连字符的变量命名规范如lower-hyphen
2、LOWER_UNDERSCORE -> c++变量命名规范如lower_underscore
3、LOWER_CAMEL -> java变量命名规范如lowerCamel
4、UPPER_CAMEL -> java和c++类的命名规范如UpperCamel
5、UPPER_UNDERSCORE -> java和c++常量的命名规范如UPPER_UNDERSCORE
|
static String |
toSeparatedFormat(String camelcaseFormat,
char separator)
驼峰转为带分隔符名字,如驼峰转换为下划线:CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, camelCaseName);
|
static String |
trimUrlPath(String urlPath) |
static String |
withDotSuffix(String str) |
public static boolean isMatch(String s, String p)
'?' Matches any single character.
'*' Matches any sequence of characters (including the empty sequence).
isMatch("aa","a") = false
isMatch("aa","aa") = true
isMatch("aaa","aa") = false
isMatch("aa", "*") = true
isMatch("aa", "a*") = true
isMatch("ab", "?*") = true
isMatch("aab", "c*a*b") = false
s - the textp - the wildcard patterntrue if the string match patternpublic static String toSeparatedFormat(String camelcaseFormat, char separator)
camelcaseFormat - the camelcase formatseparator - the separator characterCaseFormat.to(CaseFormat, String)public static String toCamelcaseFormat(String separatedFormat, char separator)
separatedFormat - the separated formatseparator - the separator characterCaseFormat.to(CaseFormat, String)public static String concatUrlPath(String prefixPath, String suffixPath)
e.g.: concatUrlPath("/a", "/b/c") -> /a/b/c
prefixPath - the prefix pathsuffixPath - the suffix pathpublic static String substringAfterLast(String str, String separator)
str - the stringseparator - the separatorCopyright © 2024. All rights reserved.