extension StringProtocol {
func slice(_ start: Int, _ end: Int) -> SubSequence {
let lower = index(self.startIndex, offsetBy: start)
let upper = index(lower, offsetBy: end - start)
return self[lower...upper]
}
}
"BibinJ".slice(2, 4) // Answer is "bin"
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)