org.opennms.core.utils
Class AlphaNumeric

java.lang.Object
  extended by org.opennms.core.utils.AlphaNumeric

public class AlphaNumeric
extends Object

Convenience classes for parsing and manipulating Strings.

Version:
$Id: $
Author:
Mike Davidson , OpenNMS , Mike Davidson , OpenNMS

Constructor Summary
AlphaNumeric()
           
 
Method Summary
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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.


Copyright © 2011. All Rights Reserved.