com.google.common.base.Ascii.isLowerCase()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(6.2k)|赞(0)|评价(0)|浏览(151)

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

Ascii.isLowerCase介绍

[英]Indicates whether c is one of the twenty-six lowercase ASCII alphabetic characters between 'a' and 'z' inclusive. All others (including non-ASCII characters) return false.
[中]指示c是否为包含“a”和“z”之间的二十六个小写ASCII字母字符之一。所有其他字符(包括非ASCII字符)返回false。

代码示例

代码示例来源:origin: google/guava

private boolean hasLowerCase() {
 for (char c : chars) {
  if (Ascii.isLowerCase(c)) {
   return true;
  }
 }
 return false;
}

代码示例来源:origin: google/guava

/**
 * If the argument is a {@linkplain #isLowerCase(char) lowercase ASCII character} returns the
 * uppercase equivalent. Otherwise returns the argument.
 */
public static char toUpperCase(char c) {
 return isLowerCase(c) ? (char) (c ^ CASE_MASK) : c;
}

代码示例来源:origin: google/j2objc

private boolean hasLowerCase() {
 for (char c : chars) {
  if (Ascii.isLowerCase(c)) {
   return true;
  }
 }
 return false;
}

代码示例来源:origin: google/j2objc

/**
 * If the argument is a {@linkplain #isLowerCase(char) lowercase ASCII character} returns the
 * uppercase equivalent. Otherwise returns the argument.
 */
public static char toUpperCase(char c) {
 return isLowerCase(c) ? (char) (c ^ CASE_MASK) : c;
}

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

/**
 * If the argument is a {@linkplain #isLowerCase(char) lowercase ASCII character} returns the
 * uppercase equivalent. Otherwise returns the argument.
 */
public static char toUpperCase(char c) {
 return isLowerCase(c) ? (char) (c ^ CASE_MASK) : c;
}

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

private boolean hasLowerCase() {
 for (char c : chars) {
  if (Ascii.isLowerCase(c)) {
   return true;
  }
 }
 return false;
}

代码示例来源:origin: google/guava

/**
 * Returns a copy of the input string in which all {@linkplain #isLowerCase(char) lowercase ASCII
 * characters} have been converted to uppercase. All other characters are copied without
 * modification.
 */
public static String toUpperCase(String string) {
 int length = string.length();
 for (int i = 0; i < length; i++) {
  if (isLowerCase(string.charAt(i))) {
   char[] chars = string.toCharArray();
   for (; i < length; i++) {
    char c = chars[i];
    if (isLowerCase(c)) {
     chars[i] = (char) (c ^ CASE_MASK);
    }
   }
   return String.valueOf(chars);
  }
 }
 return string;
}

代码示例来源:origin: google/j2objc

/**
 * Returns a copy of the input string in which all {@linkplain #isLowerCase(char) lowercase ASCII
 * characters} have been converted to uppercase. All other characters are copied without
 * modification.
 */
public static String toUpperCase(String string) {
 int length = string.length();
 for (int i = 0; i < length; i++) {
  if (isLowerCase(string.charAt(i))) {
   char[] chars = string.toCharArray();
   for (; i < length; i++) {
    char c = chars[i];
    if (isLowerCase(c)) {
     chars[i] = (char) (c ^ CASE_MASK);
    }
   }
   return String.valueOf(chars);
  }
 }
 return string;
}

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

/**
 * Returns a copy of the input string in which all {@linkplain #isLowerCase(char) lowercase ASCII
 * characters} have been converted to uppercase. All other characters are copied without
 * modification.
 */
public static String toUpperCase(String string) {
 int length = string.length();
 for (int i = 0; i < length; i++) {
  if (isLowerCase(string.charAt(i))) {
   char[] chars = string.toCharArray();
   for (; i < length; i++) {
    char c = chars[i];
    if (isLowerCase(c)) {
     chars[i] = (char) (c ^ CASE_MASK);
    }
   }
   return String.valueOf(chars);
  }
 }
 return string;
}

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

public String apply(String input) {
  if (!input.isEmpty()) {
   if (this == CAPITALIZED && !Ascii.isUpperCase(input.charAt(0))) {
    return CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, input);
   }
   if (this == LOWERIZED && !Ascii.isLowerCase(input.charAt(0))) {
    return CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_CAMEL, input);
   }
  }
  return input;
 }
}

代码示例来源:origin: google/error-prone

&& identifier.charAt(0) == 'T'
&& Ascii.isUpperCase(identifier.charAt(1))
&& Ascii.isLowerCase(identifier.charAt(2))) {

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

private static boolean shouldDisableFor(Reporter reporter, Element element) {
  while (element != null) {
   if (element.getKind() == ElementKind.PACKAGE) {
    for (String segment : DOT_SPLITTER.split(((PackageElement) element).getQualifiedName())) {
     if (!segment.isEmpty() && Ascii.isUpperCase(segment.charAt(0))) {
      reporter.warning(About.INCOMPAT, WARNING_START + " uppercase package names");
      return true;
     }
    }
   }
   if (element.getKind().isClass() || element.getKind().isInterface()) {
    if (Ascii.isLowerCase(element.getSimpleName().charAt(0))) {
     reporter.warning(About.INCOMPAT, WARNING_START + " lowercase class names");
     return true;
    }
   }
   element = element.getEnclosingElement();
  }
  return false;
 }
}

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

if (!Ascii.isLowerCase(member.getSimpleName().charAt(0))) {
 reporter.withElement(member)
   .warning("Methods not starting with lowercase ascii letter might not work properly",

代码示例来源:origin: google/guava

public void testCharsLower() {
 for (char c : LOWER.toCharArray()) {
  String str = String.valueOf(c);
  assertTrue(str, c == Ascii.toLowerCase(c));
  assertFalse(str, c == Ascii.toUpperCase(c));
  assertTrue(str, Ascii.isLowerCase(c));
  assertFalse(str, Ascii.isUpperCase(c));
 }
}

代码示例来源:origin: google/guava

public void testCharsUpper() {
 for (char c : UPPER.toCharArray()) {
  String str = String.valueOf(c);
  assertFalse(str, c == Ascii.toLowerCase(c));
  assertTrue(str, c == Ascii.toUpperCase(c));
  assertFalse(str, Ascii.isLowerCase(c));
  assertTrue(str, Ascii.isUpperCase(c));
 }
}

代码示例来源:origin: google/guava

public void testCharsIgnored() {
 for (char c : IGNORED.toCharArray()) {
  String str = String.valueOf(c);
  assertTrue(str, c == Ascii.toLowerCase(c));
  assertTrue(str, c == Ascii.toUpperCase(c));
  assertFalse(str, Ascii.isLowerCase(c));
  assertFalse(str, Ascii.isUpperCase(c));
 }
}

代码示例来源:origin: org.jboss.eap/wildfly-client-all

private boolean hasLowerCase() {
 for (char c : chars) {
  if (Ascii.isLowerCase(c)) {
   return true;
  }
 }
 return false;
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

/**
 * If the argument is a {@linkplain #isLowerCase(char) lowercase ASCII character} returns the
 * uppercase equivalent. Otherwise returns the argument.
 */
public static char toUpperCase(char c) {
 return isLowerCase(c) ? (char) (c & 0x5f) : c;
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics

private boolean hasLowerCase() {
 for (char c : chars) {
  if (Ascii.isLowerCase(c)) {
   return true;
  }
 }
 return false;
}

代码示例来源:origin: org.kill-bill.billing/killbill-platform-osgi-bundles-logger

/**
 * If the argument is a {@linkplain #isLowerCase(char) lowercase ASCII character} returns the
 * uppercase equivalent. Otherwise returns the argument.
 */
public static char toUpperCase(char c) {
 return isLowerCase(c) ? (char) (c ^ CASE_MASK) : c;
}

相关文章