Open In App

Scala Char isControl() method with example

Last Updated : 03 Nov, 2019
Improve
Improve
Like Article
Like
Save
Share
Report

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


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads