当前位置: 首页>>代码示例>>Java>>正文


Java Mode.NUMERIC属性代码示例

本文整理汇总了Java中com.google.zxing.qrcode.decoder.Mode.NUMERIC属性的典型用法代码示例。如果您正苦于以下问题:Java Mode.NUMERIC属性的具体用法?Java Mode.NUMERIC怎么用?Java Mode.NUMERIC使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.google.zxing.qrcode.decoder.Mode的用法示例。


在下文中一共展示了Mode.NUMERIC属性的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: chooseMode

/**
 * Choose the best mode by examining the content. Note that 'encoding' is used as a hint;
 * if it is Shift_JIS, and the input is only double-byte Kanji, then we return {@link Mode#KANJI}.
 */
private static Mode chooseMode(String content, String encoding) {
  if ("Shift_JIS".equals(encoding) && isOnlyDoubleByteKanji(content)) {
    // Choose Kanji mode if all input are double-byte characters
    return Mode.KANJI;
  }
  boolean hasNumeric = false;
  boolean hasAlphanumeric = false;
  for (int i = 0; i < content.length(); ++i) {
    char c = content.charAt(i);
    if (c >= '0' && c <= '9') {
      hasNumeric = true;
    } else if (getAlphanumericCode(c) != -1) {
      hasAlphanumeric = true;
    } else {
      return Mode.BYTE;
    }
  }
  if (hasAlphanumeric) {
    return Mode.ALPHANUMERIC;
  }
  if (hasNumeric) {
    return Mode.NUMERIC;
  }
  return Mode.BYTE;
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:29,代码来源:Encoder.java

示例2: chooseMode

/**
 * Choose the best mode by examining the content. Note that 'encoding' is used as a hint;
 * if it is Shift_JIS, and the input is only double-byte Kanji, then we return {@link Mode#KANJI}.
 */
private static Mode chooseMode(String content, String encoding) {
  if ("Shift_JIS".equals(encoding)) {
    // Choose Kanji mode if all input are double-byte characters
    return isOnlyDoubleByteKanji(content) ? Mode.KANJI : Mode.BYTE;
  }
  boolean hasNumeric = false;
  boolean hasAlphanumeric = false;
  for (int i = 0; i < content.length(); ++i) {
    char c = content.charAt(i);
    if (c >= '0' && c <= '9') {
      hasNumeric = true;
    } else if (getAlphanumericCode(c) != -1) {
      hasAlphanumeric = true;
    } else {
      return Mode.BYTE;
    }
  }
  if (hasAlphanumeric) {
    return Mode.ALPHANUMERIC;
  }
  if (hasNumeric) {
    return Mode.NUMERIC;
  }
  return Mode.BYTE;
}
 
开发者ID:SudarAbisheck,项目名称:ZXing-Orient,代码行数:29,代码来源:Encoder.java

示例3: chooseMode

/**
 * Choose the best mode by examining the content. Note that 'encoding' is used as a hint;
 * if it is Shift_JIS, and the input is only double-byte Kanji, then we return {@link Mode#KANJI}.
 */
private static Mode chooseMode(String content, String encoding) {
    if ("Shift_JIS".equals(encoding)) {
        // Choose Kanji mode if all input are double-byte characters
        return isOnlyDoubleByteKanji(content) ? Mode.KANJI : Mode.BYTE;
    }
    boolean hasNumeric = false;
    boolean hasAlphanumeric = false;
    for (int i = 0; i < content.length(); ++i) {
        char c = content.charAt(i);
        if (c >= '0' && c <= '9') {
            hasNumeric = true;
        } else if (getAlphanumericCode(c) != -1) {
            hasAlphanumeric = true;
        } else {
            return Mode.BYTE;
        }
    }
    if (hasAlphanumeric) {
        return Mode.ALPHANUMERIC;
    }
    if (hasNumeric) {
        return Mode.NUMERIC;
    }
    return Mode.BYTE;
}
 
开发者ID:Ag47,项目名称:TrueTone,代码行数:29,代码来源:Encoder.java

示例4: chooseMode

/**
 * Choose the best mode by examining the content. Note that 'encoding' is used as a hint;
 * if it is Shift_JIS, and the input is only double-byte Kanji, then we return {@link com.google.zxing.qrcode.decoder.Mode#KANJI}.
 */
private static Mode chooseMode(String content, String encoding) {
  if ("Shift_JIS".equals(encoding)) {
    // Choose Kanji mode if all input are double-byte characters
    return isOnlyDoubleByteKanji(content) ? Mode.KANJI : Mode.BYTE;
  }
  boolean hasNumeric = false;
  boolean hasAlphanumeric = false;
  for (int i = 0; i < content.length(); ++i) {
    char c = content.charAt(i);
    if (c >= '0' && c <= '9') {
      hasNumeric = true;
    } else if (getAlphanumericCode(c) != -1) {
      hasAlphanumeric = true;
    } else {
      return Mode.BYTE;
    }
  }
  if (hasAlphanumeric) {
    return Mode.ALPHANUMERIC;
  }
  if (hasNumeric) {
    return Mode.NUMERIC;
  }
  return Mode.BYTE;
}
 
开发者ID:bushidowallet,项目名称:bushido-android-app,代码行数:29,代码来源:Encoder.java

示例5: chooseMode

/**
 * Choose the best mode by examining the content. Note that 'encoding' is
 * used as a hint; if it is Shift_JIS, and the input is only double-byte
 * Kanji, then we return {@link Mode#KANJI}.
 */
private static Mode chooseMode(String content, String encoding) {
	if ("Shift_JIS".equals(encoding)) {
		// Choose Kanji mode if all input are double-byte characters
		return isOnlyDoubleByteKanji(content) ? Mode.KANJI : Mode.BYTE;
	}
	boolean hasNumeric = false;
	boolean hasAlphanumeric = false;
	for (int i = 0; i < content.length(); ++i) {
		char c = content.charAt(i);
		if (c >= '0' && c <= '9') {
			hasNumeric = true;
		} else if (getAlphanumericCode(c) != -1) {
			hasAlphanumeric = true;
		} else {
			return Mode.BYTE;
		}
	}
	if (hasAlphanumeric) {
		return Mode.ALPHANUMERIC;
	}
	if (hasNumeric) {
		return Mode.NUMERIC;
	}
	return Mode.BYTE;
}
 
开发者ID:cping,项目名称:RipplePower,代码行数:30,代码来源:Encoder.java

示例6: chooseMode

/**
 * Choose the best mode by examining the content. Note that 'encoding' is used as a hint;
 * if it is Shift_JIS, and the input is only double-byte Kanji, then we return {@link Mode#KANJI}.
 */
public static Mode chooseMode(String content, String encoding) {
  if ("Shift_JIS".equals(encoding)) {
    // Choose Kanji mode if all input are double-byte characters
    return isOnlyDoubleByteKanji(content) ? Mode.KANJI : Mode.BYTE;
  }
  boolean hasNumeric = false;
  boolean hasAlphanumeric = false;
  for (int i = 0; i < content.length(); ++i) {
    char c = content.charAt(i);
    if (c >= '0' && c <= '9') {
      hasNumeric = true;
    } else if (getAlphanumericCode(c) != -1) {
      hasAlphanumeric = true;
    } else {
      return Mode.BYTE;
    }
  }
  if (hasAlphanumeric) {
    return Mode.ALPHANUMERIC;
  } else if (hasNumeric) {
    return Mode.NUMERIC;
  }
  return Mode.BYTE;
}
 
开发者ID:emdete,项目名称:Simplicissimus,代码行数:28,代码来源:Encoder.java

示例7: chooseMode

/**
 * Choose the best mode by examining the content. Note that 'encoding' is
 * used as a hint; if it is Shift_JIS, and the input is only double-byte
 * Kanji, then we return {@link com.google.zxing.qrcode.decoder.Mode#KANJI}.
 */
private static Mode chooseMode(String content, String encoding) {
	if ("Shift_JIS".equals(encoding)) {
		// Choose Kanji mode if all input are double-byte characters
		return isOnlyDoubleByteKanji(content) ? Mode.KANJI : Mode.BYTE;
	}
	boolean hasNumeric = false;
	boolean hasAlphanumeric = false;
	for (int i = 0; i < content.length(); ++i) {
		char c = content.charAt(i);
		if (c >= '0' && c <= '9') {
			hasNumeric = true;
		} else if (getAlphanumericCode(c) != -1) {
			hasAlphanumeric = true;
		} else {
			return Mode.BYTE;
		}
	}
	if (hasAlphanumeric) {
		return Mode.ALPHANUMERIC;
	}
	if (hasNumeric) {
		return Mode.NUMERIC;
	}
	return Mode.BYTE;
}
 
开发者ID:Tinker-S,项目名称:FaceBarCodeDemo,代码行数:30,代码来源:Encoder.java

示例8: chooseMode

private static Mode chooseMode(String content, String encoding) {
    if (!"Shift_JIS".equals(encoding)) {
        boolean hasNumeric = false;
        boolean hasAlphanumeric = false;
        for (int i = 0; i < content.length(); i++) {
            char c = content.charAt(i);
            if (c >= '0' && c <= '9') {
                hasNumeric = true;
            } else if (getAlphanumericCode(c) == -1) {
                return Mode.BYTE;
            } else {
                hasAlphanumeric = true;
            }
        }
        if (hasAlphanumeric) {
            return Mode.ALPHANUMERIC;
        }
        if (hasNumeric) {
            return Mode.NUMERIC;
        }
        return Mode.BYTE;
    } else if (isOnlyDoubleByteKanji(content)) {
        return Mode.KANJI;
    } else {
        return Mode.BYTE;
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:27,代码来源:Encoder.java

示例9: a

private static Mode a(String s, String s1)
{
    int i = 0;
    if ("Shift_JIS".equals(s1))
    {
        if (a(s))
        {
            return Mode.KANJI;
        } else
        {
            return Mode.BYTE;
        }
    }
    boolean flag = false;
    boolean flag1 = false;
    while (i < s.length()) 
    {
        char c1 = s.charAt(i);
        if (c1 >= '0' && c1 <= '9')
        {
            flag1 = true;
        } else
        if (a(c1) != -1)
        {
            flag = true;
        } else
        {
            return Mode.BYTE;
        }
        i++;
    }
    if (flag)
    {
        return Mode.ALPHANUMERIC;
    }
    if (flag1)
    {
        return Mode.NUMERIC;
    } else
    {
        return Mode.BYTE;
    }
}
 
开发者ID:vishnudevk,项目名称:MiBandDecompiled,代码行数:43,代码来源:Encoder.java


注:本文中的com.google.zxing.qrcode.decoder.Mode.NUMERIC属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。