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