very useful to format Strings
//left(): get the leftmost len characters of a String.
StringUtils.left("abc", 0) ==> ""
StringUtils.left("abc", 1) ==> "a"
StringUtils.left("abc", 2) ==> "ab"
StringUtils.leftPad("999", 4, '0') ==> "0999"
StringUtils.leftPad("999", 5, '0') ==> "00999"
StringUtils.rightPad("999", 4, '0') ==> "9990"
StringUtils.rightPad("999", 5, '0') ==> "99900"
StringUtils.stripToEmpty(null) = ""; //very useful to convert null to empty String.
StringUtils.stripToEmpty(" abc") ==> "abc"
StringUtils.stripToEmpty(" abc ") ==>"abc"
StringUtils.stripToEmpty(" a bc ") ==>"a bc"
StringUtils.isBlank(null) ==> ture
StringUtils.isBlank("") ==> true
StringUtils.isBlanck(" ") ==> true
more often we use isNotBlank(myString) //to make sure myString is a valid non-empty string.
//the only difference is whitespace is not considered as isEmpty.
StringUtils.isEmpty(null) ==> ture
StringUtils.isEmpty("") ==> true
StringUtils.isEmpty(" ") ==> false //see the difference with isBlank
String[] doesn't have a method called contains, but you could use ArrayUtils.contains
String[] stars = {"Tom", "Sam"};
ArrayUtils.contains(starts, "Sam") ==> true