Class AlphaNumeric


  • public abstract class AlphaNumeric
    extends Object
    Convenience classes for parsing and manipulating Strings.
    Author:
    Mike Davidson
    • Constructor Detail

      • AlphaNumeric

        public AlphaNumeric()
    • Method Detail

      • parseAndReplace

        public static String parseAndReplace​(String str,
                                             char replacement)
        Any character in the passed string which does not match one of the following values is replaced by the specified replacement character. Ascii chars: 0 - 9 (Decimal 48 - 57) A - Z (Decimal 65 - 90) a - z (Decimal 97 - 122) For example: 'Ethernet 10/100' is converted to 'Ethernet_10_100'
        Parameters:
        str - string to be converted
        replacement - replacement character
        Returns:
        Converted value which can be used in a file name.
      • parseAndReplaceExcept

        public static String parseAndReplaceExcept​(String str,
                                                   char replacement,
                                                   String except)
        Any character in the passed string which does not match one of the following values is replaced by the specified replacement character, unless it is contained in the exception string. Ascii chars: 0 - 9 (Decimal 48 - 57) A - Z (Decimal 65 - 90) a - z (Decimal 97 - 122) For example: 'Ethernet 10/100' is converted to 'Ethernet_10_100'
        Parameters:
        str - string to be converted
        replacement - replacement character
        except - string containing exception characters
        Returns:
        Converted value which can be used in a file name.
      • parseAndTrim

        public static String parseAndTrim​(String str)
        Any character in the passed string which does not match one of the following values is replaced by an Ascii space and then trimmed from the resulting string. Ascii chars: 0 - 9 (Decimal 48 - 57) A - Z (Decimal 65 - 90) a - z (Decimal 97 - 122)
        Parameters:
        str - string to be converted
        Returns:
        Converted value.