Class StringTools


  • public class StringTools
    extends java.lang.Object
    This class implements useful string functions
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  StringTools.ESCAPE
      Defines escape encodings that are supported.
    • Constructor Summary

      Constructors 
      Constructor Description
      StringTools()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String escape​(StringTools.ESCAPE e, java.lang.String s)
      Escape a String according to the defined escape sequence requested
      static java.lang.String normaliseEncoding​(java.lang.String encodingName)
      Normalises several common encodings found, for instance in HTTP or HTML headers, into the compatible Java encoding
      static java.lang.String toLowerCase​(java.lang.String value)
      Rewrote the toLowercase method to improve performances.
      static java.lang.String toUpperCase​(java.lang.String value)  
      static java.lang.String unescape​(StringTools.ESCAPE e, java.lang.String s)
      Unescape a String according to the defined escape sequence requested
      static int utf8_length​(java.lang.String s)
      Returns how long String s is in bytes, if encoded in UTF-8
      • Methods inherited from class java.lang.Object

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

      • StringTools

        public StringTools()
    • Method Detail

      • escape

        public static java.lang.String escape​(StringTools.ESCAPE e,
                                              java.lang.String s)
        Escape a String according to the defined escape sequence requested
      • unescape

        public static java.lang.String unescape​(StringTools.ESCAPE e,
                                                java.lang.String s)
        Unescape a String according to the defined escape sequence requested
      • utf8_length

        public static int utf8_length​(java.lang.String s)
        Returns how long String s is in bytes, if encoded in UTF-8
        Parameters:
        s - The string to be measured.
        Returns:
        The number of bytes s is when encoded in UTF-8
      • normaliseEncoding

        public static java.lang.String normaliseEncoding​(java.lang.String encodingName)
        Normalises several common encodings found, for instance in HTTP or HTML headers, into the compatible Java encoding
      • toLowerCase

        public static final java.lang.String toLowerCase​(java.lang.String value)
        Rewrote the toLowercase method to improve performances. In Ldap, attributesType are supposed to use ASCII chars : 'a'-'z', 'A'-'Z', '0'-'9', '.' and '-' only.
        Parameters:
        value - The String to lowercase
        Returns:
        The lowercase string
      • toUpperCase

        public static final java.lang.String toUpperCase​(java.lang.String value)