Class StringUtil


  • public class StringUtil
    extends java.lang.Object
    Utility methods for working with Strings.
    Author:
    Martin Davis
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String NEWLINE  
    • Constructor Summary

      Constructors 
      Constructor Description
      StringUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      static java.lang.String chars​(char c, int n)  
      static java.lang.String getStackTrace​(java.lang.Throwable t)
      Returns an throwable's stack trace
      static java.lang.String getStackTrace​(java.lang.Throwable t, int depth)  
      static java.lang.String spaces​(int n)  
      static java.lang.String[] split​(java.lang.String s, java.lang.String separator)
      Mimics the the Java SE String.split(String) method.
      static java.lang.String toString​(double d)
      Deprecated.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • NEWLINE

        public static final java.lang.String NEWLINE
    • Constructor Detail

      • StringUtil

        public StringUtil()
    • Method Detail

      • split

        public static java.lang.String[] split​(java.lang.String s,
                                               java.lang.String separator)
        Mimics the the Java SE String.split(String) method.
        Parameters:
        s - the string to split.
        separator - the separator to use.
        Returns:
        the array of split strings.
      • getStackTrace

        public static java.lang.String getStackTrace​(java.lang.Throwable t)
        Returns an throwable's stack trace
      • getStackTrace

        public static java.lang.String getStackTrace​(java.lang.Throwable t,
                                                     int depth)
      • toString

        public static java.lang.String toString​(double d)
        Deprecated.
        Returns a string representation of the given number, using a format compatible with WKT.
        Parameters:
        d - a number
        Returns:
        a string
      • spaces

        public static java.lang.String spaces​(int n)
      • chars

        public static java.lang.String chars​(char c,
                                             int n)