How to get a substring between two indexes of a string in Kotlin

1 Answer

0 votes
fun main() {
    val s = "Kotlin Programming"
    val startIndex = 3
    val endIndex = 10

    val substring = s.substring(startIndex, endIndex)
    println(substring)  
}

 
 
/*
run:

lin Pro
 
*/

 



answered Dec 16, 2024 by avibootz
...