Class StringUtils

java.lang.Object
net.dermetfan.utils.StringUtils

public class StringUtils
extends java.lang.Object
utility methods for operations on Strings
Since:
0.6.0
  • Constructor Summary

    Constructors
    Constructor Description
    StringUtils()  
  • Method Summary

    Modifier and Type Method Description
    static int count​(char c, java.lang.String string)  
    static int count​(char c, java.lang.String string, int beginIndex, int endIndex)  
    static int count​(int c, java.lang.String string)  
    static int count​(int c, java.lang.String string, int beginIndex, int endIndex)  
    static int count​(java.lang.String target, java.lang.String string)
    same as count without overlapping occurrences
    static int count​(java.lang.String target, java.lang.String string, boolean overlap)  
    static int count​(java.lang.String target, java.lang.String string, int beginIndex, int endIndex)
    same as count without overlapping occurrences
    static int count​(java.lang.String target, java.lang.String string, int beginIndex, int endIndex, boolean overlap)  
    static boolean isJavaIdentifierPart​(char c)
    for GWT compatibility
    static boolean isJavaIdentifierPart​(int codePoint)
    for GWT compatibility
    static boolean isJavaIdentifierStart​(char c)
    for GWT compatibility
    static boolean isJavaIdentifierStart​(int codePoint)
    for GWT compatibility
    static java.lang.String remove​(int beginIndex, int endIndex, java.lang.String string)  
    static java.lang.String remove​(int index, java.lang.String string)  
    static java.lang.String replace​(int index, char replacement, java.lang.String string)  
    static java.lang.String replace​(int index, java.lang.String replacement, java.lang.String string)  
    static java.lang.String toJavaIdentifier​(java.lang.String string)  

    Methods inherited from class java.lang.Object

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

    • StringUtils

      public StringUtils()
  • Method Details

    • toJavaIdentifier

      public static java.lang.String toJavaIdentifier​(java.lang.String string)
      Parameters:
      string - the String to convert to a valid java identifier, as far as possible
    • isJavaIdentifierStart

      public static boolean isJavaIdentifierStart​(char c)
      for GWT compatibility
      See Also:
      Character.isJavaIdentifierStart(char)
    • isJavaIdentifierStart

      public static boolean isJavaIdentifierStart​(int codePoint)
      for GWT compatibility
      See Also:
      Character.isJavaIdentifierStart(int)
    • isJavaIdentifierPart

      public static boolean isJavaIdentifierPart​(char c)
      for GWT compatibility
      See Also:
      Character.isJavaIdentifierPart(char)
    • isJavaIdentifierPart

      public static boolean isJavaIdentifierPart​(int codePoint)
      for GWT compatibility
      See Also:
      Character.isJavaIdentifierPart(int)
    • replace

      public static java.lang.String replace​(int index, java.lang.String replacement, java.lang.String string)
      Parameters:
      index - the index of the character to replace
      replacement - the replacement for the character at the given index
      string - the String in which to replace
      Returns:
      a representation of the given String with the contents replaced
    • replace

      public static java.lang.String replace​(int index, char replacement, java.lang.String string)
      See Also:
      replace(int, String, String)
    • remove

      public static java.lang.String remove​(int beginIndex, int endIndex, java.lang.String string)
      Parameters:
      beginIndex - the index of the first character to remove
      endIndex - the index at which to stop the removal
      string - the String from which to remove
      Returns:
      a representation of the given String with contents removed
    • remove

      public static java.lang.String remove​(int index, java.lang.String string)
      See Also:
      remove(int, int, String)
    • count

      public static int count​(java.lang.String target, java.lang.String string, int beginIndex, int endIndex, boolean overlap)
      Parameters:
      overlap - if occurrences are allowed to overlap
      See Also:
      count(int, String, int, int)
    • count

      public static int count​(java.lang.String target, java.lang.String string, int beginIndex, int endIndex)
      same as count without overlapping occurrences
      See Also:
      count(String, String, int, int, boolean)
    • count

      public static int count​(java.lang.String target, java.lang.String string, boolean overlap)
      See Also:
      count(String, String, int, int, boolean)
    • count

      public static int count​(java.lang.String target, java.lang.String string)
      same as count without overlapping occurrences
      See Also:
      count(String, String, boolean)
    • count

      public static int count​(int c, java.lang.String string, int beginIndex, int endIndex)
      Parameters:
      c - the character to count
      string - the String in which to count
      Returns:
      the number of occurrences of c in string in the range from beginIndex to endIndex
    • count

      public static int count​(char c, java.lang.String string, int beginIndex, int endIndex)
      See Also:
      count(int, String, int, int)
    • count

      public static int count​(int c, java.lang.String string)
      See Also:
      count(int, String, int, int)
    • count

      public static int count​(char c, java.lang.String string)
      See Also:
      count(char, String, int, int)