在不使用正则表达式的情况下,识别 string.charAt(index) 是 Java 中的 A-z 字母还是数字的最佳和/或最简单的方法是什么?谢谢.
What is the best and/or easiest way to recognize if a string.charAt(index) is an A-z letter or a number in Java without using regular expressions? Thanks.
Character.isDigit(string.charAt(index)) (JavaDoc) 如果是数字则返回 trueCharacter.isLetter(string.charAt(index)) (JavaDoc) 如果是字母则返回 true
Character.isDigit(string.charAt(index)) (JavaDoc) will return true if it's a digit
Character.isLetter(string.charAt(index)) (JavaDoc) will return true if it's a letter
这篇关于在不使用正则表达式的情况下,判断一个字符是 Java 中的字母还是数字的最佳方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
“Char 不能被取消引用"错误quot;Char cannot be dereferencedquot; error(“Char 不能被取消引用错误)
Java Switch 语句 - 是“或"/“和"可能的?Java Switch Statement - Is quot;orquot;/quot;andquot; possible?(Java Switch 语句 - 是“或/“和可能的?)
Java替换字符串特定位置的字符?Java Replace Character At Specific Position Of String?(Java替换字符串特定位置的字符?)
具有 int 和 char 操作数的三元表达式的类型是什么What is the type of a ternary expression with int and char operands?(具有 int 和 char 操作数的三元表达式的类型是什么?)
读取文本文件并存储出现的每个字符Read a text file and store every single character occurrence(读取文本文件并存储出现的每个字符)
为什么我需要在 byte 和 short 上显式转换 char 原语Why do I need to explicitly cast char primitives on byte and short?(为什么我需要在 byte 和 short 上显式转换 char 原语?)