Class StringHelper


  • public abstract class StringHelper
    extends java.lang.Object
    Miscellaneous String utilities
    Author:
    Fabrice Rivart, Bruno Dillenseger
    • Constructor Summary

      Constructors 
      Constructor Description
      StringHelper()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String convertJavaIdentifier​(java.lang.String string)
      Returns a valid Java identifier by removing non valid character.
      static java.lang.String escapeProperty​(java.lang.String prop)
      Java Properties values and keys need escaping when storing them to conform to the Properties.load() specification.
      static boolean isEnabled​(java.lang.String value)
      Checks if the given String is one among "true", "yes", "on" (ignoring case) or "1".
      static boolean isNullOrEmpty​(java.lang.String value)  
      • Methods inherited from class java.lang.Object

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

      • StringHelper

        public StringHelper()
    • Method Detail

      • convertJavaIdentifier

        public static java.lang.String convertJavaIdentifier​(java.lang.String string)
        Returns a valid Java identifier by removing non valid character.
        Parameters:
        string - string to convert into a valid Java identifier
        Returns:
        a valid Java identifier
      • escapeProperty

        public static java.lang.String escapeProperty​(java.lang.String prop)
        Java Properties values and keys need escaping when storing them to conform to the Properties.load() specification.
        Parameters:
        prop - a property key or value to escape
        Returns:
        the escaped key or value ready for storing
      • isEnabled

        public static boolean isEnabled​(java.lang.String value)
        Checks if the given String is one among "true", "yes", "on" (ignoring case) or "1".
        Parameters:
        value - the string to check
        Returns:
        true if value equals "true", "yes", "on" (ignoring case) or "1"; false otherwise.
      • isNullOrEmpty

        public static boolean isNullOrEmpty​(java.lang.String value)