Answers for "kotlin substring"

1

kotlin substring

val name = "James Smith"
    
    // Get just 'James' with subSequence()
    val james = name.subSequence(0, 5)
    
    // First argument is inclusive
    // Second argument is exclusive
Posted by: Guest on October-27-2020
0

kotlin substring in string

val name = "James Smith"

    // contains() returns true if 'James is in
    // string name and false otherwise
    val isSubstring = name.contains("James")
Posted by: Guest on October-27-2020

Browse Popular Code Answers by Language