Class StringUtil

java.lang.Object
de.murmelmeister.murmelapi.utils.StringUtil

public final class StringUtil extends Object
Utility class for string operations.
  • Field Details

    • VALID_SQL_PATTERN

      public static final Pattern VALID_SQL_PATTERN
  • Constructor Details

    • StringUtil

      public StringUtil()
  • Method Details

    • startsWithIgnoreCase

      public static boolean startsWithIgnoreCase(String str, String prefix)
      Checks if a String starts with another String ignoring case sensitivity.
      Parameters:
      str - the input String to check
      prefix - the prefix to check against
      Returns:
      true if the input String starts with the specified prefix, ignoring case sensitivity, or false otherwise. Returns false if either the input String or the prefix is null.
    • checkArgumentSQL

      public static <T> T checkArgumentSQL(T value)
      Checks if the given value is a valid SQL argument.
      Parameters:
      value - the value to check
      Returns:
      the same value passed as the parameter if it is valid
      Throws:
      IllegalArgumentException - if the value contains invalid characters. Only alphanumerics and -_.?!*invalid input: '<'>:/ are allowed.
    • checkAllObjects

      public static Object[] checkAllObjects(Object[] objects)
      Checks all objects in the given array and returns a concatenated string representation of the checked objects.
      Parameters:
      objects - the array of objects to check
      Returns:
      a string representation of the checked objects, separated by commas. Returns an empty string if the array is empty.
      Throws:
      IllegalArgumentException - if any of the objects contains invalid characters. Only alphanumerics and -_.?!*invalid input: '<'>:/ are allowed.