Scala String toCharArray() method with example Last Updated : 29 Oct, 2019 Comments Improve Suggest changes Like Article Like Report The toCharArray() method is utilized to convert a stated string to CharArray. Method Definition: char[] toCharArray() Return Type: It returns CharArray. Example: 1# Scala // Scala program of toCharArray() // method // Creating object object GfG { // Main method def main(args:Array[String]) { // Applying toCharArray method val result = "GeeksforGeeks".toCharArray() for(m1<-result) { // Displays output println(m1) } } } Output: G e e k s f o r G e e k s Example: 2# Scala // Scala program of toCharArray() // method // Creating object object GfG { // Main method def main(args:Array[String]) { // Applying toCharArray method val result = "Nidhi".toCharArray() for(m1 <- result) { // Displays output println(m1) } } } Output: N i d h i Comment More infoAdvertise with us Next Article Scala String toCharArray() method with example nidhi1352singh Follow Improve Article Tags : Scala Scala Scala-Method Scala-Strings Similar Reads Scala Set toArray() method with example The toArray() is utilized to return an array consisting of all the elements of the set. Method Definition: def toArray: Array[A] Return Type: It returns an array consisting of all the elements of the set. Example #1: Scala // Scala program of toArray() // method // Creating object object GfG { // Ma 1 min read Scala Stack toArray() method with example In Scala Stack class, the toArray() is utilized to return an array consisting of all the elements of the stack. Method Definition: def toArray: Array[A] Return Type: It returns an array consisting of all the elements of the stack. Example #1: Scala // Scala program of toArray() // method // Import S 2 min read Scala String toString() method with example The toString() method is utilized to return a string object itself. Method Definition: String toString() Return Type: It returns the string object. Example: 1# Scala // Scala program of toString() // method // Creating object object GfG { // Main method def main(args:Array[String]) { // Applying toS 1 min read Scala SortedSet toArray() method with example The toArray() is utilized to return an array consisting of all the elements of the SortedSet. Method Definition: def toArray: Array[A] Return Type: It returns an array consisting of all the elements of the SortedSet. Example #1: Scala // Scala program of toArray() // method import scala.collection.i 1 min read Scala SortedMap toArray() method with example The toArray() method is utilized to display an array from the Scala SortedMap. Method Definition: def toArray: Array[(A, B)] Return Type: It returns an array from the stated SortedMap. Example #1: Scala // Scala program of toArray() // method import scala.collection.immutable.SortedMap // Creating o 1 min read Scala - String Methods with Examples In Scala, as in Java, a string is a sequence of characters. In Scala, objects of String are immutable which means a constant and cannot be changed once created. In the rest of this section, we discuss the important methods of java.lang.String class. char charAt(int index): This method is used to ret 12 min read Scala Map toArray() method with example The toArray() method is utilized to display an array from the Scala map. Method Definition: def toArray: Array[(A, B)] Return Type: It returns an array from the stated map. Example #1: Scala // Scala program of toArray() // method // Creating object object GfG { // Main method def main(args:Array[St 1 min read Scala TreeSet toString() method with example The toString() method is utilized to return a string representation of the TreeSet object. Method Definition: def toString(): String Return Type: It returns a string representation of the TreeSet object. Example #1: Scala // Scala program of toString() // method // Import TreeSet import scala.collec 1 min read Scala Queue toArray() method with example The toArray() is utilized to return an array consisting of all the elements of the queue. Method Definition: def toArray: Array[A] Return Type: It returns an array consisting of all the elements of the queue. Example #1: Scala // Scala program of toArray() // method // Import Queue import scala.coll 1 min read Scala Int toChar() method with example The toChar() method is utilized to convert the specified int number into char type value. Method Definition: (Number).toChar Return Type: It returns the converted char datatype value. Example #1: Scala // Scala program of Int toChar() // method // Creating object object GfG { // Main method def main 1 min read Like