is Identifier Character - Java java.lang

Java examples for java.lang:Assert

Description

is Identifier Character

Demo Code


//package com.java2s;

public class Main {
    public static void main(String[] argv) throws Exception {
        char c = 'a';
        System.out.println(isIdentifierCharacter(c));
    }//w w  w.  j a v  a  2 s  .  com

    public static boolean isIdentifierCharacter(char c) {
        return isAsciiAlphabet(c) || c == '_' || Character.isDigit(c);
    }

    public static boolean isAsciiAlphabet(char c) {
        return c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z';
    }
}

Related Tutorials