本文整理了Java中java.lang.Character.isLetter()
方法的一些代码示例,展示了Character.isLetter()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Character.isLetter()
方法的具体详情如下:
包路径:java.lang.Character
类名称:Character
方法名:isLetter
[英]Indicates whether the specified character is a letter.
[中]
代码示例来源:origin: google/guava
@Override
public boolean matches(char c) {
return Character.isLetter(c);
}
代码示例来源:origin: redisson/redisson
protected boolean shouldQuote(String string) {
boolean ws = false;
for (int ii = 0; ii < string.length(); ii++) {
final char ch = string.charAt(ii);
if (ii==0 && !Character.isLetter(ch) )
return true;
if (!Character.isLetterOrDigit(ch) && ch != '_' && ch != '-' && ch != '(' && ch != ')' && ch != '[' && ch != ']' && ch != '.') {
ws = true;
break;
}
}
return ws;
}
代码示例来源:origin: prestodb/presto
@Override
public boolean matches(char c) {
return Character.isLetter(c);
}
代码示例来源:origin: redisson/redisson
protected boolean isIdStart(int ch) {
return Character.isLetter(ch) || ch == '$' || ch == '#' || ch == '_';
}
代码示例来源:origin: google/j2objc
@Override
public boolean matches(char c) {
return Character.isLetter(c);
}
代码示例来源:origin: spring-projects/spring-framework
/**
* Does the supplied content contain an XML opening tag. If the parse state is currently
* in an XML comment then this method always returns false. It is expected that all comment
* tokens will have consumed for the supplied content before passing the remainder to this method.
*/
private boolean hasOpeningTag(String content) {
if (this.inComment) {
return false;
}
int openTagIndex = content.indexOf('<');
return (openTagIndex > -1 && (content.length() > openTagIndex + 1) &&
Character.isLetter(content.charAt(openTagIndex + 1)));
}
代码示例来源:origin: stanfordnlp/CoreNLP
protected static boolean containsLetter(String s) {
if (s == null) {
return false;
}
for (int i = 0, len = s.length(); i < len; i++) {
if (Character.isLetter(s.charAt(i))) {
return true;
}
}
return false;
}
代码示例来源:origin: stanfordnlp/CoreNLP
/**
* Returns whether a part of speech tag is the tag for a punctuation mark (by
* checking whether the first character is a letter.
*
* @param label
* part of speech tag
* @return whether the tag is (typically) assigned to punctuation
*/
private boolean isPunctuationLabel(String label) {
return !Character.isLetter(label.charAt(0))
&& !(label.equals("$") || label.equals("%"));
}
代码示例来源:origin: stanfordnlp/CoreNLP
private static boolean hasLetter(String str) {
if (str.length() < 1) {
return false;
}
for (int i = 0; i < str.length(); i++) {
if (Character.isLetter(str.charAt(i))) {
return true;
}
}
return false;
}
代码示例来源:origin: stanfordnlp/CoreNLP
private static int hasApostropheBlock(String s) {
for(int i = s.length() - 1; i > 0; i --){
if(s.charAt(i) == '\'' && i < s.length() - 1){
return i;
}
if(! Character.isLetter(s.charAt(i))){
return -1;
}
}
return -1;
}
代码示例来源:origin: stanfordnlp/CoreNLP
protected static boolean containsAlphanumeric(String s) {
if (s == null) {
return false;
}
for (int i = 0, len = s.length(); i < len; i++) {
if (Character.isLetter(s.charAt(i)) || Character.isDigit(s.charAt(i))) {
return true;
}
}
return false;
}
代码示例来源:origin: alibaba/druid
static String clean(String str) {
if (str == null || str.length() == 0) {
return str;
}
int len = str.length();
char[] chars = new char[len];
int count = 0;
for (int i = 0; i < len; i++) {
if (Character.isLetter(str.charAt(i))) {
chars[count++] = str.charAt(i);
}
}
if (count == len) {
return str.toUpperCase(java.util.Locale.ENGLISH);
}
return new String(chars, 0, count).toUpperCase(java.util.Locale.ENGLISH);
}
代码示例来源:origin: apache/incubator-dubbo
public List<URL> getCacheUrls(URL url) {
for (Map.Entry<Object, Object> entry : properties.entrySet()) {
String key = (String) entry.getKey();
String value = (String) entry.getValue();
if (key != null && key.length() > 0 && key.equals(url.getServiceKey())
&& (Character.isLetter(key.charAt(0)) || key.charAt(0) == '_')
&& value != null && value.length() > 0) {
String[] arr = value.trim().split(URL_SPLIT);
List<URL> urls = new ArrayList<>();
for (String u : arr) {
urls.add(URL.valueOf(u));
}
return urls;
}
}
return null;
}
代码示例来源:origin: apache/incubator-dubbo
public List<URL> getCacheUrls(URL url) {
for (Map.Entry<Object, Object> entry : properties.entrySet()) {
String key = (String) entry.getKey();
String value = (String) entry.getValue();
if (key != null && key.length() > 0 && key.equals(url.getServiceKey())
&& (Character.isLetter(key.charAt(0)) || key.charAt(0) == '_')
&& value != null && value.length() > 0) {
String[] arr = value.trim().split(URL_SPLIT);
List<URL> urls = new ArrayList<>();
for (String u : arr) {
urls.add(URL.valueOf(u));
}
return urls;
}
}
return null;
}
代码示例来源:origin: go-lang-plugin-org/go-lang-idea-plugin
private static boolean checkPrefix(@Nullable String name, @NotNull String prefix) {
// https://github.com/golang/go/blob/master/src/cmd/go/test.go#L1161 – isTest()
if (name == null || !name.startsWith(prefix)) return false;
if (prefix.length() == name.length()) return true;
char c = name.charAt(prefix.length());
return !Character.isLetter(c) || !Character.isLowerCase(c);
}
}
代码示例来源:origin: google/guava
@Override
protected int nextEscapeIndex(CharSequence csq, int index, int end) {
while (index < end && !Character.isLetter(csq.charAt(index))) {
index++;
}
return index;
}
};
代码示例来源:origin: lets-blade/blade
private static void validateParamChar(char cc, int idx) {
if (!(isDigit(cc) || isLetter(cc) || '.' == cc))
throw UncheckedTemplateException.invalidCharacterInParam(cc, idx);
}
}
代码示例来源:origin: lets-blade/blade
private static void validateParamChar(char cc, int idx) {
if (!(isDigit(cc) || isLetter(cc) || '.' == cc))
throw UncheckedTemplateException.invalidCharacterInParam(cc, idx);
}
}
代码示例来源:origin: checkstyle/checkstyle
private boolean START_sempred(RuleContext _localctx, int predIndex) {
switch (predIndex) {
case 4:
return recognizeXmlTags && (Character.isLetter(_input.LA(1)) || _input.LA(1) == '/');
}
return true;
}
private boolean AUTHOR_LITERAL_sempred(RuleContext _localctx, int predIndex) {
代码示例来源:origin: alibaba/fastjson
public final void nextIdent() {
while (isWhitespace(ch)) {
next();
}
if (ch == '_' || ch == '$' || Character.isLetter(ch)) {
scanIdent();
} else {
nextToken();
}
}
内容来源于网络,如有侵权,请联系作者删除!