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