Class IpsStringUtils


  • public final class IpsStringUtils
    extends java.lang.Object
    A collection of utility methods for Strings. We don't use a class library like apache-commons here to minimize the dependencies for the generated code.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String EMPTY  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean isBlank​(java.lang.String s)
      Returns true if s is either null, the empty string or a string that only contains whitespace, otherwise false.
      static boolean isEmpty​(java.lang.String s)
      Returns true if s is either null or the empty string, otherwise false.
      static boolean isNotEmpty​(java.lang.String s)
      Returns true if s is neither null nor the empty string, otherwise false.
      static java.lang.String join​(java.lang.Iterable<?> iterable)
      Joins the elements of the provided Iterable into a single String containing the provided elements with the default separator ", ".
      static java.lang.String join​(java.lang.Iterable<?> iterable, java.lang.String separator)
      Joins the elements of the provided Iterable into a single String containing the provided elements with the given separator.
      static <T> java.lang.String join​(java.lang.Iterable<T> iterable, java.util.function.Function<? super T,​java.lang.String> toString)
      Joins the elements of the provided Iterable into a single String containing the provided elements, converted to String with the given toString Function, with the default separator ", ".
      static <T> java.lang.String join​(java.lang.Iterable<T> iterable, java.util.function.Function<? super T,​java.lang.String> toString, java.lang.String separator)
      Joins the elements of the provided Iterable into a single String containing the provided elements, converted to String with the given toString Function, with the given separator.
      static java.lang.String join​(java.lang.Object[] objectArray)
      Joins the elements of the provided array into a single String containing the provided elements with the default separator ", ".
      static java.lang.String join​(java.lang.Object[] objectArray, java.lang.String separator)
      Joins the elements of the provided array into a single String containing the provided elements with the given separator.
      static java.lang.String join​(java.util.Collection<?> collection, java.lang.String separator)
      Joins the elements of the provided Collection into a single String containing the provided elements with the given separator.
      static java.lang.String toLowerFirstChar​(java.lang.String string)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • isEmpty

        public static final boolean isEmpty​(java.lang.String s)
        Returns true if s is either null or the empty string, otherwise false.
      • isNotEmpty

        public static final boolean isNotEmpty​(java.lang.String s)
        Returns true if s is neither null nor the empty string, otherwise false.
      • isBlank

        public static final boolean isBlank​(java.lang.String s)
        Returns true if s is either null, the empty string or a string that only contains whitespace, otherwise false.
      • join

        public static final java.lang.String join​(java.util.Collection<?> collection,
                                                  java.lang.String separator)
        Joins the elements of the provided Collection into a single String containing the provided elements with the given separator. No delimiter is added before or after the list.
        Parameters:
        collection - the Collection of values to join together, may be null
        separator - the separator to use, null treated as ""
        Returns:
        the joined String, empty if the collection is null
      • join

        public static final java.lang.String join​(java.lang.Iterable<?> iterable,
                                                  java.lang.String separator)
        Joins the elements of the provided Iterable into a single String containing the provided elements with the given separator. No delimiter is added before or after the list.
        Parameters:
        iterable - the Collection of values to join together, may be null
        separator - the separator to use, null treated as ""
        Returns:
        the joined String, empty if the collection is null
      • join

        public static final java.lang.String join​(java.lang.Iterable<?> iterable)
        Joins the elements of the provided Iterable into a single String containing the provided elements with the default separator ", ". No delimiter is added before or after the list.
        Parameters:
        iterable - the Collection of values to join together, may be null
        Returns:
        the joined String, empty if the collection is null
      • join

        public static final java.lang.String join​(java.lang.Object[] objectArray)
        Joins the elements of the provided array into a single String containing the provided elements with the default separator ", ". No delimiter is added before or after the list.
        Parameters:
        objectArray - the array of values to join together, may be null
        Returns:
        the joined String, empty if the collection is null
      • join

        public static final java.lang.String join​(java.lang.Object[] objectArray,
                                                  java.lang.String separator)
        Joins the elements of the provided array into a single String containing the provided elements with the given separator. No delimiter is added before or after the list.
        Parameters:
        objectArray - the array of values to join together, may be null
        separator - the separator to use, null treated as ""
        Returns:
        the joined String, empty if the collection is null
      • join

        public static final <T> java.lang.String join​(java.lang.Iterable<T> iterable,
                                                      java.util.function.Function<? super T,​java.lang.String> toString)
        Joins the elements of the provided Iterable into a single String containing the provided elements, converted to String with the given toString Function, with the default separator ", ". No delimiter is added before or after the list.
        Parameters:
        iterable - the Collection of values to join together, may be null
        toString - the Function to convert an element from the Iterable to a String
        Returns:
        the joined String, null if the collection is null
      • join

        public static final <T> java.lang.String join​(java.lang.Iterable<T> iterable,
                                                      java.util.function.Function<? super T,​java.lang.String> toString,
                                                      java.lang.String separator)
        Joins the elements of the provided Iterable into a single String containing the provided elements, converted to String with the given toString Function, with the given separator. No delimiter is added before or after the list.
        Parameters:
        iterable - the Collection of values to join together, may be null
        separator - the separator to use, null treated as ""
        toString - the Function to convert an element from the Iterable to a String
        Returns:
        the joined String, null if the collection is null
      • toLowerFirstChar

        public static final java.lang.String toLowerFirstChar​(java.lang.String string)