Class CommonUtil
- java.lang.Object
-
- com.github.unafraid.telegrambot.util.CommonUtil
-
public class CommonUtil extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description CommonUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanisDigit(java.lang.String text)static booleanisDouble(java.lang.String text)static <T extends java.lang.Enum<T>>
booleanisEnum(java.lang.String name, java.lang.Class<T> enumType)static booleanisFloat(java.lang.String text)static booleanisInteger(java.lang.String text)static intparseInt(java.lang.String intValue, int defaultValue)
-
-
-
Method Detail
-
parseInt
public static int parseInt(java.lang.String intValue, int defaultValue)- Parameters:
intValue-defaultValue-- Returns:
- intValue as int if its valid integer value, defaultValue otherwise
-
isDigit
public static boolean isDigit(java.lang.String text)
- Parameters:
text-- Returns:
trueif text can be parsed as long,false
-
isInteger
public static boolean isInteger(java.lang.String text)
- Parameters:
text- - the text to check- Returns:
trueiftextis integer,falseotherwise
-
isFloat
public static boolean isFloat(java.lang.String text)
- Parameters:
text- - the text to check- Returns:
trueiftextis float,falseotherwise
-
isDouble
public static boolean isDouble(java.lang.String text)
- Parameters:
text- - the text to check- Returns:
trueiftextis double,falseotherwise
-
isEnum
public static <T extends java.lang.Enum<T>> boolean isEnum(java.lang.String name, java.lang.Class<T> enumType)- Type Parameters:
T-- Parameters:
name- - the text to checkenumType-- Returns:
trueiftextis enum,falseotherwise
-
-