isSurrogate()方法用于查找指定的char值是否为Unicode代理代码单元。这样的值本身并不表示字符,而是在UTF-16编码中的补充字符表示中使用。
函数定义: def isSurrogate: Boolean
返回类型: It returns true if the stated character is surrogate else it returns false.
示例:1#
// Scala program of isSurrogate() 
// method 
  
// Creating object 
object GfG 
{  
  
    // Main method 
    def main(args:Array[String]) 
    { 
      
        // Applying isSurrogate() method  
        val result = ('\ud8b4').isSurrogate 
          
        // Displays output 
        println(result) 
      
    } 
} 
输出:
true
示例:2#
// Scala program of isSurrogate() 
// method 
  
// Creating object 
object GfG 
{  
  
    // Main method 
    def main(args:Array[String]) 
    { 
      
        // Applying isSurrogate() method 
        val result = ('\u0555').isSurrogate 
          
        // Displays output 
        println(result) 
      
    } 
} 
输出:
false
相关用法
注:本文由纯净天空筛选整理自nidhi1352singh大神的英文原创作品 Scala Char isSurrogate() method with example。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。
