Scala String substring() method with example Last Updated : 23 Oct, 2019 Comments Improve Suggest changes Like Article Like Report 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 program of substring() // method // Creating object object GfG { // Main method def main(args:Array[String]) { // Applying substring method val result = "GeeksforGeeks".substring(8) // Displays output println(result) } } Output: Geeks Example: 2# Scala // Scala program of substring() // method // Creating object object GfG { // Main method def main(args:Array[String]) { // Applying substring method val result = "GeeksforGeeks".substring(11) // Displays output println(result) } } Output: ks Comment More infoAdvertise with us Next Article Scala String substring() method with example nidhi1352singh Follow Improve Article Tags : Scala Scala Scala-Method Scala-Strings Similar Reads 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 String trim() method with example The trim() method is utilized to omit the leading and trailing spaces in the stated string. Method Definition: String trim() Return Type: It returns the stated string after removing all the white spaces. Example: 1# Scala // Scala program of trim() // method // Creating object object GfG { // Main m 1 min read Scala String subSequence() method with example 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 // Sca 1 min read Scala Set toString() method with example The toString() method is utilized to return a string consisting of all the elements of the set. Method Definition: def toString(): String Return Type: It returns a string consisting of all the elements of the set. Example #1: Scala // Scala program of toString() // method // Creating object object G 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 String indexOf(String str) method with example The indexOf(String str) method is utilized to return the index of the sub-string which occurs first in the string stated. Method Definition: indexOf(String str) Return Type: It returns the index of the sub-string which is specified in the argument of the method. Example #1: Scala // Scala program of 1 min read Scala Map toString() method with example The toString() method is utilized to display a string from the Scala map. Method Definition: def toString(): String Return Type: It returns a string from the stated map. Example #1: Scala // Scala program of toString() // method // Creating object object GfG { // Main method def main(args:Array[Stri 1 min read Scala Int toString() method with example The toString() method is utilized to return the string representation of the specified value. Method Definition: def toString(): String Return Type: It returns the string representation of the specified value. Example #1: Scala // Scala program of Int toString() // method // Creating object object G 1 min read Scala Char toString() method with example The toString() method is utilized to convert a stated character into String. Method Definition: def toString: String Return Type: It returns the String representation of the stated character. Example: 1# Scala // Scala program of toString() // method // Creating object object GfG { // Main method de 1 min read Scala SortedMap toString() method with example The toString() method is utilized to display a string from the Scala SortedMap. Method Definition: def toString(): String Return Type: It returns a string from the stated SortedMap. Example #1: Scala // Scala program of toString() // method import scala.collection.immutable.SortedMap // Creating obj 1 min read Like