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