mirror of
https://github.com/corda/corda.git
synced 2025-01-21 03:55:00 +00:00
Added Character.isJavaIdentifierStart(int), isJavaIdentifierPart(int) and made isJavaIdentifierStart(char), isJavaIdentifierPart(char) more compact.
This commit is contained in:
parent
ab3ee4c6e2
commit
6f8a8b9436
@ -175,32 +175,22 @@ public final class Character implements Comparable<Character> {
|
||||
}
|
||||
|
||||
public static boolean isJavaIdentifierStart(char ch) {
|
||||
if (isLetter(ch)){
|
||||
return true;
|
||||
}
|
||||
if (ch == '$'){ //TODO: if (getType(ch)==CURRENCY_SYMBOL)
|
||||
return true;
|
||||
}
|
||||
if (ch == '_'){
|
||||
return true;
|
||||
}
|
||||
//TODO: if (getType(ch)==LETTER_NUMBER) return true
|
||||
return isLetter(ch) || ch == '$' || ch == '_';
|
||||
//TODO: add if (getType(ch)==LETTER_NUMBER) || getType(ch)==CURRENCY_SYMBOL
|
||||
}
|
||||
|
||||
return false;
|
||||
public static boolean isJavaIdentifierStart(int c) {
|
||||
return canCastToChar(c) && isJavaIdentifierStart((char) c);
|
||||
}
|
||||
|
||||
public static boolean isJavaIdentifierPart(char ch) {
|
||||
if (isJavaIdentifierStart(ch)){
|
||||
return true;
|
||||
}
|
||||
if (isDigit(ch)){
|
||||
return true;
|
||||
}
|
||||
|
||||
return isJavaIdentifierStart(ch) || isDigit(ch);
|
||||
//TODO:Check for numeric letters (such as a Roman numeral character),combining marks,non-spacing marks
|
||||
//if (isIdentifierIgnorable(ch)) return true
|
||||
//add isIdentifierIgnorable(ch)
|
||||
}
|
||||
|
||||
return false;
|
||||
public static boolean isJavaIdentifierPart(int c) {
|
||||
return canCastToChar(c) && isJavaIdentifierPart((char) c);
|
||||
}
|
||||
|
||||
public static int toCodePoint(char high, char low) {
|
||||
|
Loading…
Reference in New Issue
Block a user