FileDocCategorySizeDatePackage
Utils.javaAPI DocAndroid 1.5 API1683Wed May 06 22:41:06 BST 2009org.apache.harmony.security.x509

Utils

public class Utils extends Object
Text utils for processing DN string representations

Fields Summary
Constructors Summary
Methods Summary
public static booleanisPrintableString(java.lang.String str)
Checks if the string is PrintableString (see X.680)

param
str input string
return
true if the string is PrintableString, false otherwise

        for (int i= 0; i< str.length(); ++i) {
            char ch= str.charAt(i); 
            if (!(ch== 0x20 
                || ch>= 0x27 && ch<= 0x29 // '()
                || ch>= 0x2B && ch<= 0x3A // +,-./0-9:
                || ch== '=" 
                || ch== '?"
                || ch>= 'A" && ch<= 'Z"
                || ch>= 'a" && ch<= 'z")) {
                return false;
            }
        }
        return true;