Class String2

java.lang.Object
eu.svjatoslav.commons.string.String2

public class String2 extends Object
  • Constructor Details

    • String2

      public String2(String value)
    • String2

      public String2()
  • Method Details

    • clear

      public String2 clear()
    • repeat

      public String2 repeat(int count)
    • prepend

      public String2 prepend(String prefix)
    • append

      public String2 append(String suffix)
    • appendWithSeparator

      public String2 appendWithSeparator(String separator, String suffix)
    • append

      public String2 append(String s, int times)
    • trimPrefix

      public String2 trimPrefix(int cutAmount)
      Cut given amount of characters from the left of the string.
      Parameters:
      cutAmount - of characters to cut
      Returns:
      part that was cut.
    • trimPrefixIfExists

      public String2 trimPrefixIfExists(String prefix)
    • trimSuffixIfExists

      public String2 trimSuffixIfExists(String suffix)
    • trimSuffix

      public String2 trimSuffix(int charsToTrim)
    • hasSuffix

      public boolean hasSuffix(String suffix)
      Check if the string has a suffix.
      Parameters:
      suffix - to check
      Returns:
      true if the string has the suffix
    • hasPrefix

      public boolean hasPrefix(String prefix)
      Check if the string has a prefix.
      Parameters:
      prefix - to check
      Returns:
      true if the string has the prefix
    • contains

      public boolean contains(String fragment, int index)
    • enforceLength

      public String2 enforceLength(int targetLength)
    • getLength

      public int getLength()
    • getSubString

      public String getSubString(int startInclusive, int endExclusive)
    • isEmpty

      public boolean isEmpty()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getGroups

      public static String[] getGroups(String s, String regexp)