Package sc.util

Class StringUtil

  • public class StringUtil
    extends java.lang.Object
    • Constructor Summary

      Constructor Description
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String argsToString​(java.lang.String[] args)  
      static java.lang.String argsToString​(java.util.List<?> args)  
      static boolean arraysEqual​(java.lang.String[] arr1, java.lang.String[] arr2)  
      static java.lang.String arrayToCommand​(java.lang.Object[] list)  
      static java.lang.String arrayToPath​(java.lang.Object[] list, boolean normalized)
      Returns a normalized path from the list of toString'd objects
      static java.lang.String arrayToString​(java.lang.Object[] list)  
      static java.lang.String arrayToType​(java.lang.Object[] list)  
      static byte[] computeHash​(byte[] inputBytes)  
      static byte[] computeHash​(java.lang.String input)  
      static java.lang.String[] deserializeToStringArray​(byte[] byteArray)  
      static java.lang.String ellipsis​(java.lang.String text, int maxLength, boolean wholeWords)
      Truncates the text String, adding ellipsis ("...") at the end.
      static boolean equalStrings​(java.lang.String s1, java.lang.String s2)  
      static java.lang.CharSequence escapeHTML​(java.lang.CharSequence input, boolean escapeBlankLines)  
      static java.lang.String escapeQuotes​(java.lang.CharSequence in, boolean singleQuote)  
      static java.lang.String formatFloat​(double number)  
      static java.lang.String indent​(int l)  
      static java.lang.String insertLinebreaks​(java.lang.String text, int lineWidth)
      Inserts linebreaks in the given text String.
      static boolean isBlank​(java.lang.String s)  
      static boolean isEmpty​(java.lang.String s)  
      static java.lang.String repeat​(java.lang.String s, int ct)  
      static byte[] serializeToBytes​(java.lang.String[] stringArray)  
      static java.lang.String[] split​(java.lang.String source, char delim)  
      static java.lang.String[] split​(java.lang.String source, java.lang.String delim)  
      static java.lang.String[] splitQuoted​(java.lang.String source)  
      • Methods inherited from class java.lang.Object

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


        public static java.util.ArrayList<java.lang.String> EMPTY_STRING_LIST

        public static java.lang.String[] EMPTY_STRING_ARRAY
    • Constructor Detail

      • StringUtil

        public StringUtil()
    • Method Detail

      • isEmpty

        public static boolean isEmpty​(java.lang.String s)
      • isBlank

        public static boolean isBlank​(java.lang.String s)
      • argsToString

        public static java.lang.String argsToString​(java.util.List<?> args)
      • argsToString

        public static java.lang.String argsToString​(java.lang.String[] args)
      • split

        public static java.lang.String[] split​(java.lang.String source,
                                               char delim)
      • split

        public static java.lang.String[] split​(java.lang.String source,
                                               java.lang.String delim)
      • splitQuoted

        public static java.lang.String[] splitQuoted​(java.lang.String source)
      • indent

        public static java.lang.String indent​(int l)
      • repeat

        public static java.lang.String repeat​(java.lang.String s,
                                              int ct)
      • arrayToString

        public static java.lang.String arrayToString​(java.lang.Object[] list)
      • arrayToPath

        public static java.lang.String arrayToPath​(java.lang.Object[] list,
                                                   boolean normalized)
        Returns a normalized path from the list of toString'd objects
      • arrayToType

        public static java.lang.String arrayToType​(java.lang.Object[] list)
      • arrayToCommand

        public static java.lang.String arrayToCommand​(java.lang.Object[] list)
      • escapeHTML

        public static java.lang.CharSequence escapeHTML​(java.lang.CharSequence input,
                                                        boolean escapeBlankLines)
      • escapeQuotes

        public static java.lang.String escapeQuotes​(java.lang.CharSequence in,
                                                    boolean singleQuote)
      • equalStrings

        public static boolean equalStrings​(java.lang.String s1,
                                           java.lang.String s2)
      • arraysEqual

        public static boolean arraysEqual​(java.lang.String[] arr1,
                                          java.lang.String[] arr2)
      • insertLinebreaks

        public static java.lang.String insertLinebreaks​(java.lang.String text,
                                                        int lineWidth)
        Inserts linebreaks in the given text String. The lineWidth specifies the maximum number of characters to allow in a single line.
      • ellipsis

        public static java.lang.String ellipsis​(java.lang.String text,
                                                int maxLength,
                                                boolean wholeWords)
        Truncates the text String, adding ellipsis ("...") at the end. If wholeWords is true, the text before the ellipsis is further truncated so that it ends at the end of a word.
      • serializeToBytes

        public static byte[] serializeToBytes​(java.lang.String[] stringArray)
      • deserializeToStringArray

        public static java.lang.String[] deserializeToStringArray​(byte[] byteArray)
      • computeHash

        public static byte[] computeHash​(byte[] inputBytes)
      • computeHash

        public static byte[] computeHash​(java.lang.String input)
      • formatFloat

        public static java.lang.String formatFloat​(double number)