 extension String {
     
     subscript (i: Int) -> Character {
-        return self[characters.index(startIndex, offsetBy: i)]
+        return self[index(startIndex, offsetBy: i)]
     }
     
     subscript (i: Int) -> String {

    }
    
    subscript (r: Range<Int>) -> String {
        let start = characters.index(startIndex, offsetBy: r.lowerBound)
//        let end = <#T##String.CharacterView corresponding to `start`##String.CharacterView#>.index(start, offsetBy: r.upperBound - r.lowerBound)
        let end = characters.index(start, offsetBy: r.upperBound - r.lowerBound)
        return String(self[Range(start..<end)])
    }


    }
    
    func fittingSubstring(_ width: CGFloat, font: UIFont) -> String {
        for i in stride(from: count, to: 0, by: -1) {
            let substr = self[0..<i]
            if substr.width(font) <= width {
                return substr
