CurrencyFormatter

public struct CurrencyFormatter

Currency Formatter

  • Get Currency

    Declaration

    Swift

    public static func getCurrency(for currencyCode: String) -> Currency?

    Parameters

    currencyCode

    currency code

    Return Value

    instance of Currency

  • Format double amount to currency string

    Declaration

    Swift

    public static func formatDoubleAmount(_ amount: Double, with currencyCode: String) -> String

    Parameters

    amount

    amount

    currencyCode

    currency code

    Return Value

    a formatted currency string

  • Get decimal amount from formatted currency code

    Declaration

    Swift

    public static func getDecimalAmount(amount: String, currencyCode: String?) -> Double

    Parameters

    amount

    amount string

    currencyCode

    currency code

    Return Value

    a decimal amount

  • Format amount for currency code using users locale

    Declaration

    Swift

    public static func formatStringAmount(_ amount: String, with currencyCode: String) -> String

    Parameters

    currencyCode

    currency code

    Return Value

    a formatted amount string

  • Format currency amount by adding symbol and currency code

    Declaration

    Swift

    public static func addCurrencySymbolAndCode(_ amount: String, with currencyCode: String) -> String

    Parameters

    currencyCode

    currency code

    Return Value

    a formatted amount string

  • Format amount for currency code using users locale while adding symbol and currency code

    Declaration

    Swift

    public static func formatCurrencyWithSymbolAndCode(_ amount: String, with currencyCode: String) -> String

    Parameters

    currencyCode

    currency code

    Return Value

    a formatted amount string

  • Format amount for currency code and add currency symbol from Currency.json

    Declaration

    Swift

    public static func formatCurrencyWithSymbol(_ amount: String, with currencyCode: String) -> String

    Parameters

    amount

    amount to format

    currencyCode

    currency code

    Return Value

    formatted amount with currency symbol