本文整理匯總了Java中com.google.common.base.Ascii.isUpperCase方法的典型用法代碼示例。如果您正苦於以下問題:Java Ascii.isUpperCase方法的具體用法?Java Ascii.isUpperCase怎麽用?Java Ascii.isUpperCase使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.common.base.Ascii
的用法示例。
在下文中一共展示了Ascii.isUpperCase方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: detect
import com.google.common.base.Ascii; //導入方法依賴的package包/類
@Override
public String detect(String identifier) {
if (identifier.length() <= lengthsOfPrefixAndSuffix) {
return NOT_DETECTED;
}
boolean prefixMatches = prefix.isEmpty() ||
(identifier.startsWith(prefix) && Ascii.isUpperCase(identifier.charAt(prefix.length())));
boolean suffixMatches = suffix.isEmpty() || identifier.endsWith(suffix);
if (prefixMatches && suffixMatches) {
String detected = identifier.substring(prefix.length(), identifier.length() - suffix.length());
return prefix.isEmpty()
? detected
: CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_CAMEL, detected);
}
return NOT_DETECTED;
}
示例2: shouldDisableFor
import com.google.common.base.Ascii; //導入方法依賴的package包/類
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(WARNING_START + " uppercase package names");
return true;
}
}
}
if (element.getKind().isClass() || element.getKind().isInterface()) {
if (Ascii.isLowerCase(element.getSimpleName().charAt(0))) {
reporter.warning(WARNING_START + " lowercase class names");
return true;
}
}
element = element.getEnclosingElement();
}
return false;
}
示例3: endsWithWordOrIs
import com.google.common.base.Ascii; //導入方法依賴的package包/類
/**
* True when s ends with suffix in a way that suffix is not part of a larger
* word by camel-casing or underscore naming conventions.
*/
public static boolean endsWithWordOrIs(String s, String suffix) {
if (suffix.isEmpty()) {
return true;
}
String lc = Ascii.toLowerCase(s);
if (lc.endsWith(suffix)) {
int beforeSuffix = lc.length() - suffix.length() - 1;
if (beforeSuffix < 0) {
return true;
}
if (!Character.isLetterOrDigit(lc.charAt(beforeSuffix))) {
return true;
}
if (Ascii.isLowerCase(s.charAt(beforeSuffix))
&& Ascii.isUpperCase(s.charAt(beforeSuffix + 1))) {
return true;
}
}
return false;
}
示例4: apply
import com.google.common.base.Ascii; //導入方法依賴的package包/類
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;
}
示例5: apply
import com.google.common.base.Ascii; //導入方法依賴的package包/類
@Override
public String apply(String input) {
unresolved = false;
boolean assumedUnqualified = Ascii.isUpperCase(input.charAt(0));
if (assumedUnqualified) {
input = qualifyImportedIfPossible(input, false);
}
return input;
}
示例6: resolveTopForAttribute
import com.google.common.base.Ascii; //導入方法依賴的package包/類
String resolveTopForAttribute(String input) {
unresolved = false;
boolean assumedUnqualified = Ascii.isUpperCase(input.charAt(0));
if (assumedUnqualified) {
input = qualifyImportedIfPossible(input, !unresolvedYetArguments.contains(input));
}
return input;
}
示例7: hasUpperCase
import com.google.common.base.Ascii; //導入方法依賴的package包/類
private boolean hasUpperCase() {
for (char c : chars) {
if (Ascii.isUpperCase(c)) {
return true;
}
}
return false;
}
示例8: isUpperCase
import com.google.common.base.Ascii; //導入方法依賴的package包/類
public static boolean isUpperCase(char c) {
return Ascii.isUpperCase(c);
}