Class Strings

java.lang.Object
io.sundr.utils.Strings

public final class Strings extends Object
  • Method Details

    • isNullOrEmpty

      public static boolean isNullOrEmpty(String str)
    • isNotNullOrEmpty

      public static boolean isNotNullOrEmpty(String str)
    • indexOfAlphabetic

      public static int indexOfAlphabetic(String str)
    • capitalizeFirst

      public static String capitalizeFirst(String str)
    • deCapitalizeFirst

      public static String deCapitalizeFirst(String str)
    • join

      public static <T> String join(Iterable<T> items, String delimiter)
    • join

      public static <T> String join(Iterable<T> items, Function<T,String> function, String delimiter)
    • join

      public static <T> String join(T[] items, String delimiter)
    • join

      public static <T> String join(T[] items, Function<T,String> function, String delimiter)
    • getPrefix

      public static <T> String getPrefix(Iterable<T> items, Function<T,String> function)
    • getPrefix

      public static String getPrefix(Iterable<String> items)
    • loadResourceQuietly

      public static final String loadResourceQuietly(String resourceName)
    • loadResource

      public static String loadResource(String resourceName) throws IOException
      Throws:
      IOException
    • loadResourceQuietly

      public static final String loadResourceQuietly(URL resourceUrl)
    • loadResource

      public static String loadResource(URL resourceUrl) throws IOException
      Throws:
      IOException
    • compact

      public static final String compact(String main, String... other)
      Remove repeating strings that are appearing in the name. This is done by splitting words (camel case) and using each word once.
      Returns:
      The compact name.
    • prefixKeywords

      public static final String prefixKeywords(String name)
      Adds an underscore to the specified String, if its a Java Keyword.
      Parameters:
      name - The specified string.
      Returns:
      The specified string if not a keyword, the string prefixed with underscore otherwise.
    • toFieldName

      public static final String toFieldName(String name)
      Converts the string into a safe field name.
      Parameters:
      name - The field name.
      Returns:
      The safe field name.
    • toPojoName

      public static final String toPojoName(String name, String prefix, String suffix)
      Converts a name of an interface or abstract class to Pojo name. Remove leading "I" and "Abstract" or trailing "Interface".
      Parameters:
      name - The name to convert.
      prefix - The prefix to use if needed.
      suffix - The suffix to user if needed.
      Returns:
      The converted name, if a conversion actually happened or the original name prefixed and suffixed otherwise.
    • indent

      public static String indent(String indent, String s)