             //     「日本語（Shift JIS）」になってしまうため。IANA では大文字小文字を区別しないとしているのでこれはいいのだが、
             //      CFStringConvertEncodingToIANACharSetName() では .shiftJIS と .shiftJIS_X0213 がそれぞれ
             //     「SHIFT_JIS」「shift_JIS」と変換されるため、可逆性を持たせるための処理
-            return suggestedCFEncodings.first { (encoding: CFStringEncoding) in
-                encoding == .shiftJIS || encoding == .shiftJIS_X0213
-            }
+            return suggestedCFEncodings.first { $0 == .shiftJIS || $0 == .shiftJIS_X0213 }
             
             }(), cfEncoding != kCFStringEncodingInvalidId else { return nil }
         

                }
            }
            
            // text ISO-2022-JP
            if data.prefix(maxDetectionLength).contains(0x1B) {
                // check existance of typical escape sequences
                // -> It's not perfect yet works in most cases. (2016-01 by 1024p)
                for escapeSequence in ISO2022JPEscapeSequences {
                    let escapeSequenceData = Data(bytes: escapeSequence)
                    if data.range(of: escapeSequenceData) != nil {
                        if let string = String(data: data, encoding: .iso2022JP) {
                            usedEncoding = .iso2022JP
                            self = string
                            return
                        }
                    }
                }
            }
        }
        
        // try encodings in order from the top of the encoding list
        for cfEncoding: CFStringEncoding in suggestedCFEncodings {
            guard cfEncoding != kCFStringEncodingInvalidId else { continue }
            
            let encoding = String.Encoding(cfEncoding: cfEncoding)
            
            if let string = String(data: data, encoding: encoding) {


    
    /// scan encoding declaration in string
    func scanEncodingDeclaration(forTags tags: [String], upTo maxLength: Int, suggestedCFEncodings: [CFStringEncoding]) -> String.Encoding? {
        
        guard !self.isEmpty else { return nil }
        
