I want to assert a com.google.gwt.event.dom.client.KeyPressEvent
. It should match any characters or digits, and signs like ,.-+~ etc. Especially I want to exclude all "navigation" keys like arrows, insert, delete, pos1, end, F1-12 etc.
Why does the following not work?
KeyPressEvent keyEvent;
if (Character.isLetterOrDigit((int) keyEvent.getUnicodeCharCode()) {}
Result:
The method isLetterOrDigit(char) in the type Character is not applicable for the arguments (int)
Character.isLetterOrDigit(int) is only supported in Java 1.5 or newer. You may be using an older version.
Try casting to a char
instead to match the method signature:
Character.isLetterOrDigit((char)keyEvent.getUnicodeCharCode())
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.