Package org.opennms.core.utils
Class AlphaNumeric
- java.lang.Object
-
- org.opennms.core.utils.AlphaNumeric
-
public abstract class AlphaNumeric extends Object
Convenience classes for parsing and manipulating Strings.- Author:
- Mike Davidson
-
-
Constructor Summary
Constructors Constructor Description AlphaNumeric()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description 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.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.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.
-
-
-
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 convertedreplacement
- 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 convertedreplacement
- replacement characterexcept
- 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.
-
-