int (String name) { int index = name.lastIndexOf(' '); if (index != -1) { try { int c = Integer.parseInt(name.substring(index + 1), 16); if (Character.isValidCodePoint(c) && name.equals(Character.getName(c))) return c; } catch (NumberFormatException ignore) { } } return -1; }