带有示例的 Scala Char isValidShort() 方法
isValidShort()方法用于查找所述字符是否在 Short 类型的范围内。
Method Definition: def isValidShort: Boolean
Return Type: It returns true if the stated character is in the range of type Short else it returns false.
示例:1#
// Scala program of isValidShort()
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying isValidShort() method
val result = ('\u9999').isValidShort
// Displays output
println(result)
}
}
输出:
false
示例:2#
// Scala program of isValidShort()
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying isValidShort() method
val result = '\u0113'.isValidShort
// Displays output
println(result)
}
}
输出:
true