5

to slice a string in swift in 2022:

```
let anotherIndex = str.index(str.endIndex, offsetBy: -1)
let newStr = str[...anotherIndex]
```

Wow, thanks apple

Comments
Add Comment