             return nil
         }
         
-        let range = self.index(self.startIndex, offsetBy: from)..<self.index(self.startIndex, offsetBy: to)
+        let range = self.intIndex(at: from)!..<self.intIndex(at: to)!
         return self.substring(with: range)
     }
     

import Foundation

extension String {
    
    subscript (i: Int) -> Character {

        return self.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines)
    }
    
    func trim (char : Character) -> String {
        return self.trimmingCharacters(in: CharacterSet(charactersIn: "\(char)"))
    }
    
    
    func trim (charsInString : String) -> String {
        return self.trimmingCharacters(in: CharacterSet(charactersIn: charsInString))
    }
    
    mutating func remove(at:Int) {
        self.remove(at: self.intIndex(at: at)!)
    }
