Class StringHelper
- java.lang.Object
-
- com.github.kaklakariada.fritzbox.helper.StringHelper
-
public class StringHelper extends java.lang.Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanisEmpty(java.lang.CharSequence cs)Code copied 'as is' from apache-commons-lang3, class StringUtils.isEmpty()static booleanisIntegerNumber(java.lang.String cs)Note that the method does not allow for a leading sign, either positive or negative.static booleanisNumeric(java.lang.CharSequence cs)Code copied 'as is' from apache-commons-lang3, class StringUtils.isNumeric()
-
-
-
Method Detail
-
isIntegerNumber
public static boolean isIntegerNumber(java.lang.String cs)
Note that the method does not allow for a leading sign, either positive or negative.
StringUtils.isIntegerNumber(null) = false StringHelper.isIntegerNumber("")) = false StringHelper.isIntegerNumber(" ") = false StringHelper.isIntegerNumber(" 1 ") = true StringHelper.isIntegerNumber("123") = true StringUtils.isIntegerNumber("१२३") = true StringHelper.isIntegerNumber("1.1") = false StringHelper.isIntegerNumber("1.1D") = false- Parameters:
cs- the String to check, may be null- Returns:
trueif only contains digits or is enclosed by blanks, and is non-null
-
isNumeric
public static boolean isNumeric(java.lang.CharSequence cs)
Code copied 'as is' from apache-commons-lang3, class StringUtils.isNumeric()Checks if the CharSequence contains only Unicode digits. A decimal point is not a Unicode digit and returns false.
nullwill returnfalse. An empty CharSequence (length()=0) will returnfalse.Note that the method does not allow for a leading sign, either positive or negative. Also, if a String passes the numeric test, it may still generate a NumberFormatException when parsed by Integer.parseInt or Long.parseLong, e.g. if the value is outside the range for int or long respectively.
StringUtils.isNumeric(null) = false StringUtils.isNumeric("") = false StringUtils.isNumeric(" ") = false StringUtils.isNumeric("123") = true StringUtils.isNumeric("१२३") = true StringUtils.isNumeric("12 3") = false StringUtils.isNumeric("ab2c") = false StringUtils.isNumeric("12-3") = false StringUtils.isNumeric("12.3") = false StringUtils.isNumeric("-123") = false StringUtils.isNumeric("+123") = false- Parameters:
cs- the CharSequence to check, may be null- Returns:
trueif only contains digits, and is non-null
-
isEmpty
public static boolean isEmpty(java.lang.CharSequence cs)
Code copied 'as is' from apache-commons-lang3, class StringUtils.isEmpty()Checks if a CharSequence is empty ("") or null.
StringUtils.isEmpty(null) = true StringUtils.isEmpty("") = true StringUtils.isEmpty(" ") = false StringUtils.isEmpty("bob") = false StringUtils.isEmpty(" bob ") = false- Parameters:
cs- the CharSequence to check, may be null- Returns:
trueif the CharSequence is empty or null
-
-