Class StringUtil


  • public final class StringUtil
    extends java.lang.Object
    String utility class.
    • Field Summary

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

      Constructors 
      Modifier Constructor Description
      private StringUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String[] split​(java.lang.String value, char delim)
      Splits the specified String with the specified delimiter.
      static java.lang.String[] split​(java.lang.String value, char delim, int maxParts)
      Splits the specified String with the specified delimiter in maxParts maximum parts.
      static java.lang.String stripControlCharacters​(java.lang.Object value)
      Strip an Object of it's ISO control characters.
      static java.lang.String stripControlCharacters​(java.lang.String value)
      Strip a String of it's ISO control characters.
      static java.lang.String substringAfter​(java.lang.String value, char delim)
      Get the item after one char delim if the delim is found (else null).
      • Methods inherited from class java.lang.Object

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

      • NEWLINE

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

      • StringUtil

        private StringUtil()
    • Method Detail

      • stripControlCharacters

        public static java.lang.String stripControlCharacters​(java.lang.Object value)
        Strip an Object of it's ISO control characters.
        Parameters:
        value - The Object that should be stripped. This objects toString method will called and the result passed to stripControlCharacters(String).
        Returns:
        String A new String instance with its hexadecimal control characters replaced by a space. Or the unmodified String if it does not contain any ISO control characters.
      • stripControlCharacters

        public static java.lang.String stripControlCharacters​(java.lang.String value)
        Strip a String of it's ISO control characters.
        Parameters:
        value - The String that should be stripped.
        Returns:
        String A new String instance with its hexadecimal control characters replaced by a space. Or the unmodified String if it does not contain any ISO control characters.
      • split

        public static java.lang.String[] split​(java.lang.String value,
                                               char delim)
        Splits the specified String with the specified delimiter. This operation is a simplified and optimized version of String.split(String).
      • split

        public static java.lang.String[] split​(java.lang.String value,
                                               char delim,
                                               int maxParts)
        Splits the specified String with the specified delimiter in maxParts maximum parts. This operation is a simplified and optimized version of String.split(String, int).
      • substringAfter

        public static java.lang.String substringAfter​(java.lang.String value,
                                                      char delim)
        Get the item after one char delim if the delim is found (else null). This operation is a simplified and optimized version of String.split(String, int).