本文整理匯總了Java中java.lang.Character.isLetter方法的典型用法代碼示例。如果您正苦於以下問題:Java Character.isLetter方法的具體用法?Java Character.isLetter怎麽用?Java Character.isLetter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.lang.Character
的用法示例。
在下文中一共展示了Character.isLetter方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: encryptGameTitle
import java.lang.Character; //導入方法依賴的package包/類
private void encryptGameTitle() {
char oldCharTmp;
int indexTmp;
do {
indexTmp = (int)(Math.random() * gameTitle.getText().length());
oldCharTmp = gameTitle.getText().charAt(indexTmp);
} while (!Character.isLetter(oldCharTmp) || oldCharTmp == 'M');
final char oldChar = oldCharTmp;
final int index = indexTmp;
int number = (int)(Math.random() * 10);
gameTitle.setText(gameTitle.getText().substring(0, index) + number + gameTitle.getText().substring(index + 1));
Timer.schedule(new Timer.Task() {
@Override
public void run() {
gameTitle.setText(gameTitle.getText().substring(0, index) + oldChar + gameTitle.getText().substring(index + 1));
}
}, ENCRYPTION_DURATION);
}
示例2: normalizeText
import java.lang.Character; //導入方法依賴的package包/類
private String normalizeText(String input) {
StringBuffer normalized_text = new StringBuffer();
for (int i = 0; i < input.length(); i++) {
if (Character.isLetter(input.charAt(i)) || (Character.isDigit(input.charAt(i))) || Character.isWhitespace(input.charAt(i))) {
normalized_text.append(input.charAt(i));
}
}
return normalized_text.toString();
}
示例3: isAllUppercase
import java.lang.Character; //導入方法依賴的package包/類
/**
* Returns true if the given string is made up of all-uppercase characters
* (ignoring characters for which no upper-/lowercase distinction exists).
*/
public static boolean isAllUppercase(String str) {
for (int i = 0; i < str.length(); i++) {
char c = str.charAt(i);
if (Character.isLetter(c) && Character.isLowerCase(c)) {
return false;
}
}
return true;
}
示例4: isNotAllLowercase
import java.lang.Character; //導入方法依賴的package包/類
/**
* Returns true if <code>str</code> is made up of all-lowercase characters
* (ignoring characters for which no upper-/lowercase distinction exists).
* @since 2.5
*/
public static boolean isNotAllLowercase(String str) {
for (int i = 0; i < str.length(); i++) {
char c = str.charAt(i);
if (Character.isLetter(c) && !Character.isLowerCase(c)) {
return true;
}
}
return false;
}
示例5: isCapitalizedWord
import java.lang.Character; //導入方法依賴的package包/類
/**
* @param str input string
* @return true if word starts with an uppercase letter and all other letters are lowercase
*/
public static boolean isCapitalizedWord(String str) {
if (!isEmpty(str) && Character.isUpperCase(str.charAt(0))) {
for (int i = 1; i < str.length(); i++) {
char c = str.charAt(i);
if (Character.isLetter(c) && !Character.isLowerCase(c)) {
return false;
}
}
return true;
}
return false;
}