 
 
 }
+
+extension Double {
+    func split() -> [Int] {
+        return String(self).characters.split{$0 == "."}.map({
+            return Int(String($0))!
+        })
+    }
+}

    // MARK: Remove input.

    func removeLastInput() {
        if input.decimalMode {
            if input.decimal.isEmpty {
                input.decimalMode = false
            } else {

    }

    // MARK: Format as currency.
    
    private func parseInput() -> Double {
        let integer: Int = Int(input.integer)!
        let decimal: Int? = Int(input.decimal)!
        let inputString: String
        if let newDecimal = decimal {
            inputString = "\(integer).\(newDecimal)"
        } else {
            inputString = "\(integer).0"
        }
        return Double(inputString)!
    }

    func formattedInput() -> String {
        let inputValue: Double! = parseInput()
        return formatToCurrency(inputValue, code: inputCurrency.code, locale: inputCurrency.locale, symbol: inputCurrency.symbol, decimals: inputCurrency.decimals)
    }

    func formattedOutput() -> String {
        let inputValue: Double! = parseInput()
        let outputValue: Double = convertToOutputCurrency(inputValue)
        return formatToCurrency(outputValue, code: outputCurrency.code, locale: outputCurrency.locale, symbol: outputCurrency.symbol, decimals: outputCurrency.decimals)
    }
