Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SWIFT

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
 
PREVIOUS NEXT
Tagged: #swift #substring
ADD COMMENT
Topic
Name
1+8 =