I spotted this extension somewhere online a while ago (kjmcneish?) that can come in pretty handy. extension String { // Returns a range of characters (e.g. s[0…3]) subscript (r: Range<Int>) -> String { let start = advance(self.startIndex, r.startIndex) let end …

String extension for range of characters/character at nth position Read more »

Tagged with: , ,