Write a Scala program to get a substring of a given string between two specified positions
- برمجة سكالا
- 2021-09-23
- mhanasmh00489829403
الأجوبة
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
أسئلة مشابهة
القوائم الدراسية التي ينتمي لها السؤال
معلومات ذات صلة