Class StringUtils

java.lang.Object
org.sonar.java.checks.helpers.StringUtils

public class StringUtils extends Object
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    countMatches(String string, String pattern)
    Count non-overlapping occurrences of pattern in the string.
    static String[]
    flatten(Object... args)
    Build String[] by concatenating arguments of types: java.lang.String java.lang.String[] java.util.Collectioninvalid input: '<'java.lang.strings> Nested collections and arrays are not supported, and will throw an ArrayStoreException if encountered.
    static boolean
    Check if the string is null or empty.

    Methods inherited from class Object

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

    • isEmpty

      public static boolean isEmpty(@Nullable String s)
      Check if the string is null or empty.
    • countMatches

      public static int countMatches(@Nullable String string, @Nullable String pattern)
      Count non-overlapping occurrences of pattern in the string.
    • flatten

      public static String[] flatten(Object... args)
      Build String[] by concatenating arguments of types:
      1. java.lang.String
      2. java.lang.String[]
      3. java.util.Collectioninvalid input: '<'java.lang.strings>
      Nested collections and arrays are not supported, and will throw an ArrayStoreException if encountered.
      Throws:
      IllegalArgumentException - If one of the argument is not of the supported types.
      ArrayStoreException - If a collection passed as argument contains an element that is not a String.