Check out example codes for "kotlin substring in string". It will help you in understanding the concepts better.

Code Example 1

val name = "James Smith"
    // Get just 'James' with subSequence()
    val james = name.subSequence(0, 5)
    // First argument is inclusive
    // Second argument is exclusive

Code Example 2

val name = "James Smith"

    // contains() returns true if 'James is in
    // string name and false otherwise
    val isSubstring = name.contains("James")

Learn ReactJs, React Native from