I want to learn the best/simplest way to turn a string into another string but with only a subset, starting at the beginning and going to the last index of a character.
Here's an easy and short way to get a substring if you know the index:
let s = "www.stackoverflow.com"
let result = String(s.characters.prefix(17)) // "www.stackoverflow"
It won't crash the app if your index exceeds string's length:
let s = "short"
let result = String(s.characters.prefix(17)) // "short"
Both examples are Swift 3 ready.