VOOZH about

URL: https://www.geeksforgeeks.org/scala/scala-string-substringint-beginindex-int-endindex-method-with-example/

⇱ Scala String substring(int beginIndex, int endIndex) method with example - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Scala String substring(int beginIndex, int endIndex) method with example

Last Updated : 29 Oct, 2019
The substring(int beginIndex, int endIndex) method is utilized to find the sub-string from the stated String which starts and ends with the index specified.
Method Definition: String substring(int beginIndex, int endIndex) Return Type: It returns string which is the part of the stated String.
Note: It is same as sub-sequence method but the only difference between the two is that sub-sequence returns CharSequence but the above method returns string. Example: 1#
Output:
sfor
Example: 2#
Output:
Geek
Comment
Article Tags:

Explore