java.lang.Character.isAlphabetic()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(7.4k)|赞(0)|评价(0)|浏览(455)

本文整理了Java中java.lang.Character.isAlphabetic()方法的一些代码示例,展示了Character.isAlphabetic()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Character.isAlphabetic()方法的具体详情如下:
包路径:java.lang.Character
类名称:Character
方法名:isAlphabetic

Character.isAlphabetic介绍

[英]Returns true if the given code point is alphabetic. That is, if it is in any of the Lu, Ll, Lt, Lm, Lo, Nl, or Other_Alphabetic categories.
[中]

代码示例

代码示例来源:origin: stackoverflow.com

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 + " ");
}

代码示例来源:origin: languagetool-org/languagetool

int getLeftWordBoundary(String text, int pos) {
 while (pos >= 1) {
  if (Character.isAlphabetic(text.charAt(pos - 1))) {
   pos--;
  } else {
   break;
  }
 }
 return pos;
}

代码示例来源:origin: robolectric/robolectric

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;
}

代码示例来源:origin: languagetool-org/languagetool

int getRightWordBoundary(String text, int pos) {
 while (pos >= 0 && pos < text.length()) {
  if (Character.isAlphabetic(text.charAt(pos))) {
   pos++;
  } else {
   break;
  }
 }
 return pos;
}

代码示例来源:origin: konsoletyper/teavm

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);
}

代码示例来源:origin: wildfly/wildfly

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");
    }
  }
}

代码示例来源:origin: apache/hbase

/**
 * 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);
 }
}

代码示例来源:origin: speedment/speedment

@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();
}

代码示例来源:origin: oracle/opengrok

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();
}

代码示例来源:origin: google/google-java-format

/** 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;
  }
 }
}

代码示例来源:origin: checkstyle/checkstyle

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;
}

代码示例来源:origin: apache/pulsar

final char timeUnit;
if (!Character.isAlphabetic(lastChar)) {

代码示例来源:origin: apache/incubator-gobblin

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);

代码示例来源:origin: apache/hbase

if (Character.isAlphabetic(c) || Character.isDigit(c) || c == '_' || c == '-' || c == '.') {
 continue;

代码示例来源:origin: AdoptOpenJDK/jitwatch

if (Character.isAlphabetic(c) || Character.isDigit(c))

代码示例来源:origin: marytts/marytts

temp += " " + c;
} else if (Character.isAlphabetic(c) && temp.length() > 0) {
  if (Character.isDigit(temp.charAt(temp.length() - 1))) {
    temp += " " + c;

代码示例来源:origin: apache/ignite

while ((++pos < endPos) && Character.isAlphabetic(text.charAt(pos)));
if (pos == endPos)
  throw new IgniteException(errPrefix + " Expected function parameter list: " +

代码示例来源:origin: languagetool-org/languagetool

/**
 * @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);
 }
}

代码示例来源:origin: graphhopper/graphhopper

bbox = BBox.parseTwoPoints(lmStr.substring("#BBOX:".length()));
  continue;
} else if (lmStr.isEmpty() || Character.isAlphabetic(lmStr.charAt(0))) {
  continue;

代码示例来源:origin: neo4j/neo4j

@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() );
}

相关文章

Character类方法