Scala Char isHighSurrogate() 方法与示例
isHighSurrogate()方法用于查找指定的 char 值是否为 Unicode 高代理代码单元。这些值本身并不表示字符,而是用于表示 UTF-16 编码中的补充字符。
Method Definition: def isHighSurrogate: Boolean
Return Type: It returns true if the stated character is high-surrogate else it returns false.
示例:1#
// Scala program of isHighSurrogate()
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying isHighSurrogate() method
val result = ('\ud8b4').isHighSurrogate
// Displays output
println(result)
}
}
输出:
true
示例:2#
// Scala program of isHighSurrogate()
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying isHighSurrogate() method
val result = ('\u0555').isHighSurrogate
// Displays output
println(result)
}
}
输出:
false