Package org.pf4j.util

Class StringUtils


  • public class StringUtils
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      StringUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String addStart​(java.lang.String str, java.lang.String add)
      Adds a substring only if the source string does not already start with the substring, otherwise returns the source string.
      static java.lang.String format​(java.lang.String str, java.lang.Object... args)
      Format the string.
      static boolean isNotNullOrEmpty​(java.lang.String str)  
      static boolean isNullOrEmpty​(java.lang.String str)  
      • Methods inherited from class java.lang.Object

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

      • StringUtils

        public StringUtils()
    • Method Detail

      • isNullOrEmpty

        public static boolean isNullOrEmpty​(java.lang.String str)
      • isNotNullOrEmpty

        public static boolean isNotNullOrEmpty​(java.lang.String str)
      • format

        public static java.lang.String format​(java.lang.String str,
                                              java.lang.Object... args)
        Format the string. Replace "{}" with %s and format the string using String.format(String, Object...).
      • addStart

        public static java.lang.String addStart​(java.lang.String str,
                                                java.lang.String add)

        Adds a substring only if the source string does not already start with the substring, otherwise returns the source string.

        A null source string will return null. An empty ("") source string will return the empty string. A null search string will return the source string.

         StringUtils.addStart(null, *)      = *
         StringUtils.addStart("", *)        = *
         StringUtils.addStart(*, null)      = *
         StringUtils.addStart("domain.com", "www.")  = "www.domain.com"
         StringUtils.addStart("abc123", "abc")    = "abc123"
         
        Parameters:
        str - the source String to search, may be null
        add - the String to search for and add, may be null
        Returns:
        the substring with the string added if required