 
     func stringByReplacingOccurrences(_ string: String, map: [String: String], keepUnmapped: Bool = false) -> String {
         var targetString = String()
-        for i in 0..<string.count {
+        for i in 0 ..< string.count {
             let oneChar = string[string.index(string.startIndex, offsetBy: i)]
             let keyString = String(oneChar).uppercased()
             if let mappedValue = map[keyString] {


    func hasValue(_ value: String?) -> Bool {
        if let valueString = value {
            if valueString.trimmingCharacters(in: self.spaceCharacterSet).count == 0 {
                return false
            }
            return true


    func regexWithPattern(_ pattern: String) throws -> NSRegularExpression {
        var cached: NSRegularExpression?
        cached = regularExpressionPoolQueue.sync {
            regularExpressionPool[pattern]
        }

        if let cached = cached {
