Class DoxiaStringUtils

java.lang.Object
org.apache.maven.doxia.util.DoxiaStringUtils

public class DoxiaStringUtils extends Object
Utility methods for string operations. This class provides methods that were previously supplied by Apache Commons Lang3.
Since:
2.1.0
  • Constructor Details

    • DoxiaStringUtils

      private DoxiaStringUtils()
  • Method Details

    • repeat

      public static String repeat(String str, int repeat)
      Repeats a string a certain number of times.
      Parameters:
      str - the string to repeat
      repeat - number of times to repeat
      Returns:
      the repeated string
    • replace

      public static String replace(String text, String searchString, String replacement)
      Replaces all occurrences of a string within another string.
      Parameters:
      text - the text to search and replace in
      searchString - the string to search for
      replacement - the string to replace with
      Returns:
      the text with any replacements processed
    • isNotEmpty

      public static boolean isNotEmpty(String str)
      Checks if a string is not empty.
      Parameters:
      str - the string to check
      Returns:
      true if the string is not null and not empty
    • isBlank

      public static boolean isBlank(String str)
      Checks if a string is blank (null, empty, or whitespace only).
      Parameters:
      str - the string to check
      Returns:
      true if the string is null, empty, or whitespace only
    • isAllBlank

      public static boolean isAllBlank(String... strs)
      Checks if all strings are blank.
      Parameters:
      strs - the strings to check
      Returns:
      true if all strings are blank
    • split

      public static String[] split(String str, String separatorChars)
      Splits a string by specified delimiters.
      Parameters:
      str - the string to split
      separatorChars - the characters to use as delimiters
      Returns:
      an array of parsed strings, empty array if null string input
    • removeEnd

      public static String removeEnd(String str, String remove)
      Removes a substring only if it is at the end of a source string.
      Parameters:
      str - the source string
      remove - the string to remove
      Returns:
      the substring with the string removed if found
    • stripStart

      public static String stripStart(String str, String stripChars)
      Strips any of a set of characters from the start of a string.
      Parameters:
      str - the string to remove characters from
      stripChars - the characters to remove
      Returns:
      the stripped string
    • countMatches

      public static int countMatches(String str, String sub)
      Counts how many times the substring appears in the larger string.
      Parameters:
      str - the string to check
      sub - the substring to count
      Returns:
      the number of occurrences, 0 if either string is null