Class CommonUtil

java.lang.Object
com.github.unafraid.telegrambot.util.CommonUtil

public class CommonUtil extends Object
  • Constructor Details

    • CommonUtil

      public CommonUtil()
  • Method Details

    • parseInt

      public static int parseInt(String intValue, int defaultValue)
      Parameters:
      intValue - the value
      defaultValue - the default value
      Returns:
      intValue as int if its valid integer value, defaultValue otherwise
    • isDigit

      public static boolean isDigit(String text)
      Parameters:
      text - the text
      Returns:
      true if text can be parsed as long, false
    • isInteger

      public static boolean isInteger(String text)
      Parameters:
      text - - the text to check
      Returns:
      true if text is integer, false otherwise
    • isFloat

      public static boolean isFloat(String text)
      Parameters:
      text - - the text to check
      Returns:
      true if text is float, false otherwise
    • isDouble

      public static boolean isDouble(String text)
      Parameters:
      text - - the text to check
      Returns:
      true if text is double, false otherwise
    • isEnum

      public static <T extends Enum<T>> boolean isEnum(String name, Class<T> enumType)
      Type Parameters:
      T - the type
      Parameters:
      name - the text to check
      enumType - the enum type
      Returns:
      true if text is enum, false otherwise