public class StringUtils
extends java.lang.Object
Constructor and Description |
---|
StringUtils() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
capitalizeFirstLetter(java.lang.String str)
capitalize first letter
capitalizeFirstLetter(null) = null;
capitalizeFirstLetter("") = "";
capitalizeFirstLetter("2ab") = "2ab"
capitalizeFirstLetter("a") = "A"
capitalizeFirstLetter("ab") = "Ab"
capitalizeFirstLetter("Abc") = "Abc"
|
static java.lang.String |
fullWidthToHalfWidth(java.lang.String s)
transform half width char to full width char
fullWidthToHalfWidth(null) = null;
fullWidthToHalfWidth("") = "";
fullWidthToHalfWidth(new String(new char[] {12288})) = " ";
fullWidthToHalfWidth("!"#$%&) = "!
|
static java.lang.String |
getHrefInnerHtml(java.lang.String href)
get innerHtml from href
getHrefInnerHtml(null) = ""
getHrefInnerHtml("") = ""
getHrefInnerHtml("mp3") = "mp3";
getHrefInnerHtml("<a innerHtml</a>") = "<a innerHtml</a>";
getHrefInnerHtml("<a>innerHtml</a>") = "innerHtml";
getHrefInnerHtml("<a<a>innerHtml</a>") = "innerHtml";
getHrefInnerHtml("<a href="baidu.com">innerHtml</a>") = "innerHtml";
getHrefInnerHtml("<a href="baidu.com" title="baidu">innerHtml</a>") = "innerHtml";
getHrefInnerHtml(" <a>innerHtml</a> ") = "innerHtml";
getHrefInnerHtml("<a>innerHtml</a></a>") = "innerHtml";
getHrefInnerHtml("jack<a>innerHtml</a></a>") = "innerHtml";
getHrefInnerHtml("<a>innerHtml1</a><a>innerHtml2</a>") = "innerHtml2";
|
static java.lang.String |
halfWidthToFullWidth(java.lang.String s)
transform full width char to half width char
halfWidthToFullWidth(null) = null;
halfWidthToFullWidth("") = "";
halfWidthToFullWidth(" ") = new String(new char[] {12288});
halfWidthToFullWidth("!
|
static java.lang.String |
htmlEscapeCharsToString(java.lang.String source)
process special char in html
htmlEscapeCharsToString(null) = null;
htmlEscapeCharsToString("") = "";
htmlEscapeCharsToString("mp3") = "mp3";
htmlEscapeCharsToString("mp3<") = "mp3<";
htmlEscapeCharsToString("mp3>") = "mp3\>";
htmlEscapeCharsToString("mp3&mp4") = "mp3&mp4";
htmlEscapeCharsToString("mp3"mp4") = "mp3\"mp4";
htmlEscapeCharsToString("mp3<>&"mp4") = "mp3\<\>&\"mp4";
|
static boolean |
isBlank(java.lang.String str)
is null or its length is 0 or it is made by space
isBlank(null) = true;
isBlank("") = true;
isBlank(" ") = true;
isBlank("a") = false;
isBlank("a ") = false;
isBlank(" a") = false;
isBlank("a b") = false;
|
static boolean |
isEmpty(java.lang.String str)
is null or its length is 0
isEmpty(null) = true;
isEmpty("") = true;
isEmpty(" ") = false;
|
static boolean |
isEquals(java.lang.String actual,
java.lang.String expected)
compare two string
|
static java.lang.String |
nullStrToEmpty(java.lang.String str)
null string to empty string
nullStrToEmpty(null) = "";
nullStrToEmpty("") = "";
nullStrToEmpty("aa") = "aa";
|
static java.lang.String |
utf8Encode(java.lang.String str)
encoded in utf-8
utf8Encode(null) = null
utf8Encode("") = "";
utf8Encode("aa") = "aa";
utf8Encode("啊啊啊啊") = "%E5%95%8A%E5%95%8A%E5%95%8A%E5%95%8A";
|
static java.lang.String |
utf8Encode(java.lang.String str,
java.lang.String defultReturn)
encoded in utf-8, if exception, return defultReturn
|
public static boolean isBlank(java.lang.String str)
isBlank(null) = true; isBlank("") = true; isBlank(" ") = true; isBlank("a") = false; isBlank("a ") = false; isBlank(" a") = false; isBlank("a b") = false;
str
- public static boolean isEmpty(java.lang.String str)
isEmpty(null) = true; isEmpty("") = true; isEmpty(" ") = false;
str
- public static boolean isEquals(java.lang.String actual, java.lang.String expected)
actual
- expected
- ObjectUtils.isEquals(Object, Object)
public static java.lang.String nullStrToEmpty(java.lang.String str)
nullStrToEmpty(null) = ""; nullStrToEmpty("") = ""; nullStrToEmpty("aa") = "aa";
str
- public static java.lang.String capitalizeFirstLetter(java.lang.String str)
capitalizeFirstLetter(null) = null; capitalizeFirstLetter("") = ""; capitalizeFirstLetter("2ab") = "2ab" capitalizeFirstLetter("a") = "A" capitalizeFirstLetter("ab") = "Ab" capitalizeFirstLetter("Abc") = "Abc"
str
- public static java.lang.String utf8Encode(java.lang.String str)
utf8Encode(null) = null utf8Encode("") = ""; utf8Encode("aa") = "aa"; utf8Encode("啊啊啊啊") = "%E5%95%8A%E5%95%8A%E5%95%8A%E5%95%8A";
str
- java.io.UnsupportedEncodingException
- if an error occurspublic static java.lang.String utf8Encode(java.lang.String str, java.lang.String defultReturn)
str
- defultReturn
- public static java.lang.String getHrefInnerHtml(java.lang.String href)
getHrefInnerHtml(null) = "" getHrefInnerHtml("") = "" getHrefInnerHtml("mp3") = "mp3"; getHrefInnerHtml("<a innerHtml</a>") = "<a innerHtml</a>"; getHrefInnerHtml("<a>innerHtml</a>") = "innerHtml"; getHrefInnerHtml("<a<a>innerHtml</a>") = "innerHtml"; getHrefInnerHtml("<a href="baidu.com">innerHtml</a>") = "innerHtml"; getHrefInnerHtml("<a href="baidu.com" title="baidu">innerHtml</a>") = "innerHtml"; getHrefInnerHtml(" <a>innerHtml</a> ") = "innerHtml"; getHrefInnerHtml("<a>innerHtml</a></a>") = "innerHtml"; getHrefInnerHtml("jack<a>innerHtml</a></a>") = "innerHtml"; getHrefInnerHtml("<a>innerHtml1</a><a>innerHtml2</a>") = "innerHtml2";
href
- public static java.lang.String htmlEscapeCharsToString(java.lang.String source)
htmlEscapeCharsToString(null) = null; htmlEscapeCharsToString("") = ""; htmlEscapeCharsToString("mp3") = "mp3"; htmlEscapeCharsToString("mp3<") = "mp3<"; htmlEscapeCharsToString("mp3>") = "mp3\>"; htmlEscapeCharsToString("mp3&mp4") = "mp3&mp4"; htmlEscapeCharsToString("mp3"mp4") = "mp3\"mp4"; htmlEscapeCharsToString("mp3<>&"mp4") = "mp3\<\>&\"mp4";
source
- public static java.lang.String fullWidthToHalfWidth(java.lang.String s)
fullWidthToHalfWidth(null) = null; fullWidthToHalfWidth("") = ""; fullWidthToHalfWidth(new String(new char[] {12288})) = " "; fullWidthToHalfWidth("!"#$%&) = "!\"#$%&";
s
- public static java.lang.String halfWidthToFullWidth(java.lang.String s)
halfWidthToFullWidth(null) = null; halfWidthToFullWidth("") = ""; halfWidthToFullWidth(" ") = new String(new char[] {12288}); halfWidthToFullWidth("!\"#$%&) = "!"#$%&";
s
-