带有示例的 Scala Char isLetterOrDigit() 方法
isLetterOrDigit()方法用于检查指定的字符是字母还是数字。
Method Definition: def isLetterOrDigit: Boolean
Return Type: It returns true if the stated character is letter or digit else it returns false.
示例:1#
// Scala program of isLetterOrDigit()
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying isLetterOrDigit method
val result = '9'.isLetterOrDigit
// Displays output
println(result)
}
}
输出:
true
示例:2#
// Scala program of isLetterOrDigit()
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying isLetterOrDigit method
val result = 'g'.isLetterOrDigit
// Displays output
println(result)
}
}
输出:
true