本文整理了Java中java.lang.Character.toLowerCase()
方法的一些代码示例,展示了Character.toLowerCase()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Character.toLowerCase()
方法的具体详情如下:
包路径:java.lang.Character
类名称:Character
方法名:toLowerCase
[英]Returns the lower case equivalent for the specified character if the character is an upper case letter. Otherwise, the specified character is returned unchanged.
[中]如果指定字符是大写字母,则返回该字符的小写等效值。否则,指定的字符将原封不动地返回。
代码示例来源:origin: skylot/jadx
/**
* Adapt character case for case insensitive searches
*/
public static char caseChar(char ch, boolean toLower) {
return toLower ? Character.toLowerCase(ch) : ch;
}
代码示例来源:origin: spring-projects/spring-framework
public LiteralPathElement(int pos, char[] literalText, boolean caseSensitive, char separator) {
super(pos, separator);
this.len = literalText.length;
this.caseSensitive = caseSensitive;
if (caseSensitive) {
this.text = literalText;
}
else {
// Force all the text lower case to make matching faster
this.text = new char[literalText.length];
for (int i = 0; i < this.len; i++) {
this.text[i] = Character.toLowerCase(literalText[i]);
}
}
}
代码示例来源:origin: spring-projects/spring-framework
public SingleCharWildcardedPathElement(
int pos, char[] literalText, int questionMarkCount, boolean caseSensitive, char separator) {
super(pos, separator);
this.len = literalText.length;
this.questionMarkCount = questionMarkCount;
this.caseSensitive = caseSensitive;
if (caseSensitive) {
this.text = literalText;
}
else {
this.text = new char[literalText.length];
for (int i = 0; i < this.len; i++) {
this.text[i] = Character.toLowerCase(literalText[i]);
}
}
}
代码示例来源:origin: netty/netty
@Override
public boolean equals(char a, char b) {
//For motivation, why we need two checks, see comment in String#regionMatches
return Character.toUpperCase(a) == Character.toUpperCase(b) ||
Character.toLowerCase(a) == Character.toLowerCase(b);
}
}
代码示例来源:origin: libgdx/libgdx
/** @param other May be null. */
public boolean equalsIgnoreCase (StringBuilder other) {
if (this == other) return true;
if (other == null) return false;
int length = this.length;
if (length != other.length) return false;
char[] chars = this.chars, chars2 = other.chars;
for (int i = 0; i < length; i++) {
char c = chars[i];
char upper = Character.toUpperCase(chars2[i]);
if (c != upper && c != Character.toLowerCase(upper)) return false;
}
return true;
}
代码示例来源:origin: libgdx/libgdx
/** @param other May be null. */
public boolean equalsIgnoreCase (StringBuilder other) {
if (this == other) return true;
if (other == null) return false;
int length = this.length;
if (length != other.length) return false;
char[] chars = this.chars, chars2 = other.chars;
for (int i = 0; i < length; i++) {
char c = chars[i];
char upper = Character.toUpperCase(chars2[i]);
if (c != upper && c != Character.toLowerCase(upper)) return false;
}
return true;
}
代码示例来源:origin: redisson/redisson
@Override
public boolean equals(char a, char b) {
//For motivation, why we need two checks, see comment in String#regionMatches
return Character.toUpperCase(a) == Character.toUpperCase(b) ||
Character.toLowerCase(a) == Character.toLowerCase(b);
}
}
代码示例来源:origin: apache/incubator-dubbo
private static String propertyName(String pn) {
return pn.length() == 1 || Character.isLowerCase(pn.charAt(1)) ? Character.toLowerCase(pn.charAt(0)) + pn.substring(1) : pn;
}
代码示例来源:origin: apache/incubator-dubbo
private static String propertyName(String pn) {
return pn.length() == 1 || Character.isLowerCase(pn.charAt(1)) ? Character.toLowerCase(pn.charAt(0)) + pn.substring(1) : pn;
}
代码示例来源:origin: libgdx/libgdx
/** @param other May be null. */
public boolean equalsIgnoreCase (String other) {
if (other == null) return false;
int length = this.length;
if (length != other.length()) return false;
char[] chars = this.chars;
for (int i = 0; i < length; i++) {
char c = chars[i];
char upper = Character.toUpperCase(other.charAt(i));
if (c != upper && c != Character.toLowerCase(upper)) return false;
}
return true;
}
}
代码示例来源:origin: libgdx/libgdx
/** @param other May be null. */
public boolean equalsIgnoreCase (String other) {
if (other == null) return false;
int length = this.length;
if (length != other.length()) return false;
char[] chars = this.chars;
for (int i = 0; i < length; i++) {
char c = chars[i];
char upper = Character.toUpperCase(other.charAt(i));
if (c != upper && c != Character.toLowerCase(upper)) return false;
}
return true;
}
}
代码示例来源:origin: spring-projects/spring-framework
private static String changeFirstCharacterCase(String str, boolean capitalize) {
if (!hasLength(str)) {
return str;
}
char baseChar = str.charAt(0);
char updatedChar;
if (capitalize) {
updatedChar = Character.toUpperCase(baseChar);
}
else {
updatedChar = Character.toLowerCase(baseChar);
}
if (baseChar == updatedChar) {
return str;
}
char[] chars = str.toCharArray();
chars[0] = updatedChar;
return new String(chars, 0, chars.length);
}
代码示例来源:origin: skylot/jadx
private static String fromName(String name) {
if (name == null || name.isEmpty()) {
return null;
}
if (name.toUpperCase().equals(name)) {
// all characters are upper case
return name.toLowerCase();
}
String v1 = Character.toLowerCase(name.charAt(0)) + name.substring(1);
if (!v1.equals(name)) {
return v1;
}
if (name.length() < 3) {
return name + "Var";
}
return null;
}
代码示例来源:origin: shuzheng/zheng
/**
* 首字母转小写
* @param s
* @return
*/
public static String toLowerCaseFirstOne(String s) {
if (StringUtils.isBlank(s)) {
return s;
}
if (Character.isLowerCase(s.charAt(0))) {
return s;
} else {
return (new StringBuilder()).append(Character.toLowerCase(s.charAt(0))).append(s.substring(1)).toString();
}
}
代码示例来源:origin: greenrobot/greenDAO
void init2ndPass() {
if (name == null) {
char[] nameCharArray = targetEntity.getClassName().toCharArray();
nameCharArray[0] = Character.toLowerCase(nameCharArray[0]);
name = new String(nameCharArray);
}
}
代码示例来源:origin: greenrobot/greenDAO
void init2ndPass() {
if (name == null) {
char[] nameCharArray = targetEntity.getClassName().toCharArray();
nameCharArray[0] = Character.toLowerCase(nameCharArray[0]);
name = new String(nameCharArray) + "List";
}
}
代码示例来源:origin: libgdx/libgdx
public boolean keyTyped (InputEvent event, char character) {
if (!typeToSelect) return false;
long time = System.currentTimeMillis();
if (time > typeTimeout) prefix = "";
typeTimeout = time + 300;
prefix += Character.toLowerCase(character);
for (int i = 0, n = items.size; i < n; i++) {
if (List.this.toString(items.get(i)).toLowerCase().startsWith(prefix)) {
setSelectedIndex(i);
break;
}
}
return false;
}
});
代码示例来源:origin: libgdx/libgdx
public boolean keyTyped (InputEvent event, char character) {
if (!typeToSelect) return false;
long time = System.currentTimeMillis();
if (time > typeTimeout) prefix = "";
typeTimeout = time + 300;
prefix += Character.toLowerCase(character);
for (int i = 0, n = items.size; i < n; i++) {
if (List.this.toString(items.get(i)).toLowerCase().startsWith(prefix)) {
setSelectedIndex(i);
break;
}
}
return false;
}
});
代码示例来源:origin: apache/flink
/**
* Converts the given <code>StringValue</code> into a lower case variant.
*
* @param string The string to convert to lower case.
*/
public static void toLowerCase(StringValue string) {
final char[] chars = string.getCharArray();
final int len = string.length();
for (int i = 0; i < len; i++) {
chars[i] = Character.toLowerCase(chars[i]);
}
}
代码示例来源:origin: bumptech/glide
private String getClassNameString() {
StringBuilder result = new StringBuilder();
for (char c : testClass.getSimpleName().toCharArray()) {
if (Character.isUpperCase(c)) {
result.append(Character.toLowerCase(c));
}
}
return result.toString();
}
内容来源于网络,如有侵权,请联系作者删除!