Scala String toCharArray() method with example Last Updated : 29 Oct, 2019 Summarize Comments Improve Suggest changes Share 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 N 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 Like