带有示例的 Scala Char toLong() 方法
toLong()方法用于将指定字符转换为 Long 或其类型为 Long 的 ASCII 值。
Method Definition: def toLong: Long
Return Type: It returns Long or ASCII value of the corresponding letter of type Long.
示例:1#
// Scala program of toLong()
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying toLong method
val result = '\u1155'.toLong
// Displays output
println(result)
}
}
输出:
4437
示例:2#
// Scala program of toLong()
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying toLong method
val result = '\u1234'.toLong
// Displays output
println(result)
}
}
输出:
4660