Scala String subSequence() method with example Last Updated : 23 Oct, 2019 Comments Improve Suggest changes Like Article Like Report The subSequence() method is utilized to find the sub-sequence from the given String, And this sub-sequence starts and ends with the index we specify. Method Definition: CharSequence subSequence(int beginIndex, int endIndex) Return Type: It returns the resultant sub-sequence. Example: 1# Scala // Scala program of subSequence() // method // Creating object object GfG { // Main method def main(args:Array[String]) { // Applying subSequence method val result = "GeeksforGeeks".subSequence(5, 8) // Displays output println(result) } } Output: for Example: 2# Scala // Scala program of subSequence() // method // Creating object object GfG { // Main method def main(args:Array[String]) { // Applying subSequence method val result = "GeeksforGeeks".subSequence(5, 13) // Displays output println(result) } } Output: forGeeks Comment More infoAdvertise with us Next Article Scala String subSequence() method with example N nidhi1352singh Follow Improve Article Tags : Scala Scala Scala-Method Scala-Strings Similar Reads Scala String substring() method with example The substring() method is utilized to find the sub-string from the stated String which starts from the index specified. Method Definition: String substring(int beginIndex) Return Type: It returns the content from the given String Which starts from the index we specify. Example: 1# Scala // Scala pro 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 Set toSeq() method with example The toSeq() method is utilized to return a seq consisting of all the elements of the set. Method Definition: def toSeq: Seq[A] Return Type: It returns a seq consisting of all the elements of the set. Example #1: Scala // Scala program of toSeq() // method // Creating object object GfG { // Main meth 1 min read Scala Set take() method with example The take() method is utilized to return a set consisting of first 'n' elements of the set. Method Definition: def take(n: Int): Set[A] Where 'n' is specifies the number of element to select. Return Type: It returns a set consisting of first 'n' elements of the set. Example #1: Scala // Scala program 1 min read Scala Map toSeq() method with example The toSeq() method is utilized to display a sequence from the Scala map. Method Definition: def toSeq: Seq[A] Return Type: It returns a sequence from the stated map. Example #1: Scala // Scala program of toSeq() // method // Creating object object GfG { // Main method def main(args:Array[String]) { 1 min read Like