/** * 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' * * @param str * string to be converted * @param replacement * replacement character * @return Converted value which can be used in a file name. */ public static String parseAndReplace(String str, char replacement) { return parseAndReplaceExcept(str, replacement, new Character(replacement).toString()); }
String getAliasDir(String ifAlias, String ifAliasComment) { if (ifAlias != null) { if (ifAliasComment != null) { int si = ifAlias.indexOf(ifAliasComment); if (si > -1) { ifAlias = ifAlias.substring(0, si).trim(); } } if (ifAlias != null) { ifAlias = AlphaNumeric.parseAndReplaceExcept(ifAlias, AbstractSnmpCollector.nonAnRepl, AbstractSnmpCollector.AnReplEx); } } logAlias(ifAlias); return ifAlias; }