How to check email in J2ME using char

how to check email in j2me using char

In J2SE we can use Character.isLetter (c)

I want to use this:     if (Character.isLetter(c) && Character.isUpperCase(c)){} as wellelse if(Character.isSpace(c))

In the JAVA MOBILE platform Any way to use it?

+5
source share
1 answer

Seeing that you cannot use Character.isLetter(c), I would just imitate it functionally. I would do this by treating the character as a "number" using its ASCII value .

public static boolean isLetter(char c) {
    return (c > 64 && c < 91) || (c > 96 && c < 123);
}

//Not necessary but included anyways
public static boolean isUpperCase(char c) {
    return c > 64 && c < 91;
}

public static boolean isSpace(char c) {
    //Accounts for spaces and other "space-like" characters
    return c == 32 || c == 12 || c == 13 || c == 14;
}

Edit: Thanks @Nate for suggestions / corrections

+6
source

All Articles