     func truncate(_ width: CGFloat, font: UIFont) -> String {
         let ellipsis = "..."
         let substr = fittingSubstring(width - ellipsis.width(font), font: font)
-        if substr.characters.count != characters.count {
+        if substr.count != count {
             return "\(substr.trim())\(ellipsis)"
         } else {
             return self

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

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

