Answers for "swift substring"

0

swift substring

func sliceString(str: String, start: Int, end: Int) -> String {
    let data = Array(str)
    return String(data[start..<end])
}

print(sliceString(str: "0123456789", start: 0, end: 3)) // -> prints 012
Posted by: Guest on February-15-2022

Code answers related to "Swift"

Browse Popular Code Answers by Language