Class StringUtils


  • public class StringUtils
    extends java.lang.Object
    Provides static helper functions for string manipulation.
    • Constructor Summary

      Constructors 
      Constructor Description
      StringUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String capitalizeFirstLetter​(java.lang.String s)  
      static int matchWildcard​(java.lang.String source, java.lang.String pattern)
      Match two Strings, considering wildcards.
      static java.lang.String toShortString​(com.google.gson.JsonElement j, int length)  
      static java.lang.String toShortString​(java.lang.String s, int length)  
      • Methods inherited from class java.lang.Object

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

      • StringUtils

        public StringUtils()
    • Method Detail

      • toShortString

        public static java.lang.String toShortString​(java.lang.String s,
                                                     int length)
      • toShortString

        public static java.lang.String toShortString​(com.google.gson.JsonElement j,
                                                     int length)
      • capitalizeFirstLetter

        public static java.lang.String capitalizeFirstLetter​(java.lang.String s)
      • matchWildcard

        public static int matchWildcard​(java.lang.String source,
                                        java.lang.String pattern)
        Match two Strings, considering wildcards.
        • if Object.equals(Object) is true -> return 0
        • if 'pattern' matches 'source' -> return value > 1; bigger values represent a better match
        • if both Strings do not match -> return -1

        Implementation note: only one wildcard is considered. Either the entire string is "*" or the wildcard is at the beginning or at the end of the pattern String. The the JUnit test for details.

        Parameters:
        source - the String to be evaluated
        pattern - the pattern String, i.e. "meter*"
        Returns:
        an integer value representing the degree of matching