Package org.pf4j.util

Class StringUtils

java.lang.Object
org.pf4j.util.StringUtils

public class StringUtils extends Object
  • Constructor Details

    • StringUtils

      public StringUtils()
  • Method Details

    • isNullOrEmpty

      public static boolean isNullOrEmpty(String str)
    • isNotNullOrEmpty

      public static boolean isNotNullOrEmpty(String str)
    • format

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

      public static String addStart(String str, 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