當前位置: 首頁>>代碼示例>>Java>>正文


Java Character.isDigit方法代碼示例

本文整理匯總了Java中java.lang.Character.isDigit方法的典型用法代碼示例。如果您正苦於以下問題:Java Character.isDigit方法的具體用法?Java Character.isDigit怎麽用?Java Character.isDigit使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.lang.Character的用法示例。


在下文中一共展示了Character.isDigit方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: isPrintable

import java.lang.Character; //導入方法依賴的package包/類
public static boolean isPrintable(char c)
{
    if (Character.isJavaIdentifierStart(c)) {
        // Letters and $ _
        return true;
    }
    if (Character.isDigit(c)) {
        return true;
    }
    switch (Character.getType(c)) {
    case Character.MODIFIER_SYMBOL : return true; // ` ^
    case Character.DASH_PUNCTUATION : return true; // -
    case Character.MATH_SYMBOL : return true; // = ~ + | < >
    case Character.OTHER_PUNCTUATION : return true; // [email protected]#%&*;':",./?
    case Character.START_PUNCTUATION : return true; // ( [ {
    case Character.END_PUNCTUATION : return true; // ) ] }
    }
    return false;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:20,代碼來源:ORBUtility.java

示例2: getIOSVersion

import java.lang.Character; //導入方法依賴的package包/類
@Nullable
public static String getIOSVersion(@Nullable final String ua) {
    if (ua == null) return null;
    StringBuilder versionBuilder = new StringBuilder(6);
    int index = ua.indexOf("OS ");
    if (index == -1) return null;
    index += 3; // skip over "OS ".
    if (!Character.isDigit(ua.charAt(index))) {
        return null;
    }
    while (index < ua.length() && ua.charAt(index) != ' ') {
        versionBuilder.append(ua.charAt(index));
        index++;
    }
    return versionBuilder.toString().replace('_', '.');
}
 
開發者ID:indeedeng,項目名稱:proctor-demo,代碼行數:17,代碼來源:Browser.java

示例3: parseKey

import java.lang.Character; //導入方法依賴的package包/類
/** Parsing keyword to raw key code. **/
public static Object parseKey(String key){
    // note that parse algorithm makes all words upper case and removes spaces and duplicating symbols
    try {
        if (key.length() > 1 && Character.toUpperCase(key.charAt(0)) == 'R' && Character.isDigit(key.charAt(1)))
            return Integer.parseInt(key.substring(1));
    } catch (Exception e){ }

    StringBuilder sb = new StringBuilder(key.toUpperCase());

    // Ф1-24 -> F1-24
    if(sb.length() > 1 && sb.charAt(0) == 'Ф' && Character.isDigit(sb.charAt(1)))
        sb.setCharAt(0, 'F');

    if (sb.length()>1 && sb.charAt(0) == 'Э')  sb.setCharAt(0, 'Е');

    for(int i=1; i < sb.length(); i++) {
        if (sb.charAt(i) == ' ' || sb.charAt(i) == 'Ь' || sb.charAt(i - 1) == sb.charAt(i)) {
            sb.deleteCharAt(i);
            i--;
        } else if (sb.charAt(i) == 'Э') {
            sb.setCharAt(i, 'Е');
        }
    }

    String code = keyMap.get(sb.toString());
    if(code == null)
        errors.add(key);

    return code;
}
 
開發者ID:DeskChan,項目名稱:DeskChan,代碼行數:32,代碼來源:KeyboardEventNotificator.java

示例4: 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();
}
 
開發者ID:shaungeorge,項目名稱:Download_It,代碼行數:13,代碼來源:ImgurFrame.java

示例5: getWindowsPhoneVersion

import java.lang.Character; //導入方法依賴的package包/類
public static String getWindowsPhoneVersion(String ua) {
    if (ua == null) return null;
    StringBuilder versionBuilder = new StringBuilder(6);
    int index = ua.indexOf("OS ");
    if (index == -1) return null;
    index += 3; // skip over "OS ".
    if (!Character.isDigit(ua.charAt(index))) {
        return null;
    }
    while (index < ua.length() && ua.charAt(index) != ';') {
        versionBuilder.append(ua.charAt(index));
        index++;
    }
    return versionBuilder.toString();
}
 
開發者ID:indeedeng,項目名稱:proctor-demo,代碼行數:16,代碼來源:Browser.java

示例6: invoke

import java.lang.Character; //導入方法依賴的package包/類
public Object invoke(Object reader, Object doublequote, Object opts, Object pendingForms) {
	StringBuilder sb = new StringBuilder();
	Reader r = (Reader) reader;

	for(int ch = read1(r); ch != '"'; ch = read1(r))
		{
		if(ch == -1)
			throw Util.runtimeException("EOF while reading string");
		if(ch == '\\')	//escape
			{
			ch = read1(r);
			if(ch == -1)
				throw Util.runtimeException("EOF while reading string");
			switch(ch)
				{
				case 't':
					ch = '\t';
					break;
				case 'r':
					ch = '\r';
					break;
				case 'n':
					ch = '\n';
					break;
				case '\\':
					break;
				case '"':
					break;
				case 'b':
					ch = '\b';
					break;
				case 'f':
					ch = '\f';
					break;
				case 'u':
				{
				ch = read1(r);
				if (Character.digit(ch, 16) == -1)
					throw Util.runtimeException("Invalid unicode escape: \\u" + (char) ch);
				ch = readUnicodeChar((PushbackReader) r, ch, 16, 4, true);
				break;
				}
				default:
				{
				if(Character.isDigit(ch))
					{
					ch = readUnicodeChar((PushbackReader) r, ch, 8, 3, false);
					if(ch > 0377)
						throw Util.runtimeException("Octal escape sequence must be in range [0, 377].");
					}
				else
					throw Util.runtimeException("Unsupported escape character: \\" + (char) ch);
				}
				}
			}
		sb.append((char) ch);
		}
	return sb.toString();
}
 
開發者ID:mrange,項目名稱:fsharpadvent2016,代碼行數:60,代碼來源:LispReader.java


注:本文中的java.lang.Character.isDigit方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。