Methods Summary |
---|
public static int | compareToIgnoreCase(java.lang.String s1, java.lang.String s2)Compares two strings lexicographically, ignoring case
considerations.
// System.out.println(s1+" "+s2);
String su1 = s1.toUpperCase();
String su2 = s2.toUpperCase();
return su1.compareTo(su2);
|
public static byte[] | digest(byte[] digestBytes)Do an MD5 Digest.
try {
messageDigest = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException ex) {
if (Logging.REPORT_LEVEL <= Logging.ERROR) {
Logging.report(Logging.ERROR, LogChannels.LC_JSR180,
"Exception on MessageDigest instance creating " + ex);
}
}
byte[] returnValue;
returnValue = new byte[messageDigest.getDigestLength()];
messageDigest.update(digestBytes, 0, digestBytes.length);
try {
messageDigest.digest(returnValue, 0, returnValue.length);
} catch (DigestException de) {
// nothing to do
}
return returnValue;
|
public static boolean | equalsIgnoreCase(java.lang.String s1, java.lang.String s2)Compares two strings lexicographically.
return s1.toLowerCase().equals(s2.toLowerCase());
|
public static java.lang.String | generateTag()Generate a tag for a FROM header or TO header. Just return a
random 4 digit integer (should be enough to avoid any clashes!)
return new Long(System.currentTimeMillis()).toString();
|
public static java.lang.String | getQuotedString(java.lang.String str)Put quotes around a string and return it.
return '"" + str + '"";
|
public static java.lang.String | reduceString(java.lang.String input)Squeeze out white space from a string and return the reduced
string.
String newString = input.toLowerCase();
int len = newString.length();
String retval = "";
for (int i = 0; i < len; i++) {
if (newString.charAt(i) == ' "
|| newString.charAt(i) == '\t")
continue;
else retval += newString.charAt(i);
}
return retval;
|
public static java.lang.String | toHexString(byte[] b)convert an array of bytes to an hexadecimal string
int pos = 0;
char[] c = new char[b.length*2];
for (int i = 0; i < b.length; i++) {
c[pos++] = toHex[(b[i] >> 4) & 0x0F];
c[pos++] = toHex[b[i] & 0x0f];
}
return new String(c);
|