for (int i = Character.MIN_CODE_POINT; i <= Character.MAX_CODE_POINT; i++) if (Character.isJavaIdentifierStart(i) && !Character.isAlphabetic(i)) System.out.print((char) i + " "); }
int getLeftWordBoundary(String text, int pos) { while (pos >= 1) { if (Character.isAlphabetic(text.charAt(pos - 1))) { pos--; } else { break; } } return pos; }
static boolean is_alpha(final String str) { for (int i = 0; i < str.length(); i++) { if (!Character.isAlphabetic(str.charAt(i))) { return false; } } return true; }
int getRightWordBoundary(String text, int pos) { while (pos >= 0 && pos < text.length()) { if (Character.isAlphabetic(text.charAt(pos))) { pos++; } else { break; } } return pos; }
private boolean isProperPrefix(String name, String prefix) { if (!name.startsWith(prefix) || name.length() == prefix.length()) { return false; } char c = name.charAt(prefix.length()); return Character.isUpperCase(c) || !Character.isAlphabetic(c) && Character.isJavaIdentifierStart(c); }
private void parseVersion(final ByteBuffer buffer) throws IOException { while (buffer.hasRemaining()) { byte b = buffer.get(); if (b == ' ' || b == '\t') { httpVersion = current.toString().trim(); parseState++; current.setLength(0); return; } else if(Character.isDigit(b) || Character.isAlphabetic(b) || b == '.' || b == '/') { current.append((char) b); } else { throw new IOException("Invalid response"); } } }
/** * Valid namespace characters are alphabetic characters, numbers, and underscores. */ public static void isLegalNamespaceName(final byte[] namespaceName, final int start, final int end) { if(end - start < 1) { throw new IllegalArgumentException("Namespace name must not be empty"); } String nsString = new String(namespaceName, start, (end - start), StandardCharsets.UTF_8); if (nsString.equals(DISALLOWED_TABLE_NAME)) { // Per https://zookeeper.apache.org/doc/r3.4.10/zookeeperProgrammers.html#ch_zkDataModel // A znode named "zookeeper" is disallowed by zookeeper. throw new IllegalArgumentException("Tables may not be named '" + DISALLOWED_TABLE_NAME + "'"); } for (int i = 0; i < nsString.length(); i++) { // Treat the string as a char-array as some characters may be multi-byte char c = nsString.charAt(i); // ZooKeeper also has limitations, but Character.isAlphabetic omits those all // See https://zookeeper.apache.org/doc/r3.4.10/zookeeperProgrammers.html#ch_zkDataModel if (Character.isAlphabetic(c) || Character.isDigit(c)|| c == '_') { continue; } throw new IllegalArgumentException("Illegal character <" + c + "> at " + i + ". Namespaces may only contain " + "'alphanumeric characters' from any language and digits: " + nsString); } }
@Override public String javaName(final String externalName, CharUnaryOperator mutator) { final StringBuilder sb = new StringBuilder(javaNameFromExternal(externalName)); int startIndex = 0; for (int i = 0; i < externalName.length(); i++) { if (Character.isAlphabetic(sb.charAt(i))) { // Skip over any non alphabetic characers like "_" startIndex = i; break; } } if (sb.length() > startIndex) { sb.replace(startIndex, startIndex + 1, String.valueOf(mutator.applyAsChar(sb.charAt(startIndex)))); } return sb.toString(); }
private static String reportable(String value) { if (value.startsWith("#!")) { return value; } boolean allAsciiPrintable = true; for (int i = 0; i < value.length(); ++i) { char c = value.charAt(i); if (c < ' ' || c > '~') { allAsciiPrintable = false; break; } } if (allAsciiPrintable) { return value; } StringBuilder b = new StringBuilder(); int i = 0; while (i < value.length()) { int cp = Character.codePointAt(value, i); i += Character.charCount(cp); if (Character.isAlphabetic(cp)) { b.appendCodePoint(cp); } else { b.append("\\{"); b.append(String.format("%x", cp)); b.append("}"); } } return b.toString(); }
/** Classifies an identifier's case format. */ static JavaCaseFormat from(String name) { Verify.verify(!name.isEmpty()); boolean firstUppercase = false; boolean hasUppercase = false; boolean hasLowercase = false; boolean first = true; for (int i = 0; i < name.length(); i++) { char c = name.charAt(i); if (!Character.isAlphabetic(c)) { continue; } if (first) { firstUppercase = Character.isUpperCase(c); first = false; } hasUppercase |= Character.isUpperCase(c); hasLowercase |= Character.isLowerCase(c); } if (firstUppercase) { return hasLowercase ? UPPER_CAMEL : UPPERCASE; } else { return hasUppercase ? LOWER_CAMEL : LOWERCASE; } } }
private static boolean shouldAppendSpace(StringBuffer text, char firstCharToAppend) { final boolean result; if (text.length() == 0) { result = false; } else { final char last = text.charAt(text.length() - 1); result = (last == ':' || firstCharToAppend == '@' || Character.isAlphabetic(last) || Character.isAlphabetic(firstCharToAppend)) && !Character.isWhitespace(last); } return result; }
final char timeUnit; if (!Character.isAlphabetic(lastChar)) {
throw new RuntimeException("Illegal scoped property:" + propName); if (!Character.isAlphabetic(scopedName.charAt(0))) { throw new RuntimeException( "Scoped name for property " + propName + " should start with a character: " + scopedName);
if (Character.isAlphabetic(c) || Character.isDigit(c) || c == '_' || c == '-' || c == '.') { continue;
if (Character.isAlphabetic(c) || Character.isDigit(c))
temp += " " + c; } else if (Character.isAlphabetic(c) && temp.length() > 0) { if (Character.isDigit(temp.charAt(temp.length() - 1))) { temp += " " + c;
while ((++pos < endPos) && Character.isAlphabetic(text.charAt(pos))); if (pos == endPos) throw new IgniteException(errPrefix + " Expected function parameter list: " +
/** * @since public since 4.1 */ @Experimental public boolean isMisspelled(String word) { try { if (needsInit) { init(); } boolean isAlphabetic = true; if (word.length() == 1) { // hunspell dictionaries usually do not contain punctuation isAlphabetic = Character.isAlphabetic(word.charAt(0)); } return (isAlphabetic && !"--".equals(word) && hunspellDict.misspelled(word) && !ignoreWord(word)) || isProhibited(removeTrailingDot(word)); } catch (IOException e) { throw new RuntimeException(e); } }
bbox = BBox.parseTwoPoints(lmStr.substring("#BBOX:".length())); continue; } else if (lmStr.isEmpty() || Character.isAlphabetic(lmStr.charAt(0))) { continue;
@Test public void nextAlphaNumericString() { Set<Integer> seenDigits = "ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789".chars().boxed() .collect( Collectors.toSet() ); for ( int i = 0; i < ITERATIONS; i++ ) { TextValue textValue = randomValues.nextAlphaNumericTextValue( 10, 20 ); String asString = textValue.stringValue(); for ( int j = 0; j < asString.length(); j++ ) { int ch = asString.charAt( j ); assertTrue( "Not a character nor letter: " + ch, Character.isAlphabetic( ch ) || Character.isDigit( ch ) ); seenDigits.remove( ch ); } } assertThat( seenDigits, empty() ); }