Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

Scala Char isControl() method with example

  • Last Updated : 03 Nov, 2019

The isControl() method is utilized to check whether the stated character is control character or not. Where, Control characters are formatting and other non-printing characters, such as ACK, BEL, CR, FF, LF, and VT.

Method Definition: def isControl: Boolean

Return Type: It returns true if the stated character is control character else it returns false.

Example: 1#




// Scala program of isControl()
// method
  
// Creating object
object GfG
  
    // Main method
    def main(args:Array[String])
    {
      
        // Applying isControl() method 
        val result = 'a'.isControl
          
        // Displays output
        println(result)
      
    }
Output:
false

Example: 2#




// Scala program of isControl()
// method
  
// Creating object
object GfG
  
    // Main method
    def main(args:Array[String])
    {
      
        // Applying isControl() method
        val result = '\n'.isControl
          
        // Displays output
        println(result)
      
    }
Output:
true



My Personal Notes arrow_drop_up
Recommended Articles
Page :