object Scala_String {
def main(args: Array[String]): Unit = {
val str = "The quick brown fox jumps over the lazy dog.";
// Get a substring of the above string starting from
// index 10 and ending at index 26.
val new_str = str.substring(10, 26);
// Display the two strings for comparison.
println("Original = " + str);
println("From said string, substring between two positions (10,26) = " + new_str);
}
}
Sample Output:
Original = The quick brown fox jumps over the lazy dog.
From said string, substring between two positions (10,26) = brown fox jumps
Sample Output:
need an explanation for this answer? contact us directly to get an explanation for this answer