String

public extension String

The String extension

  • Returns a localized string

    Declaration

    Swift

    func localized(withComment: String? = nil) -> String

    Parameters

    withComment

    Comment for localization.

    Return Value

    Returns a substring

  • Returns a string, up to the given maximum length, containing the final elements of the collection.

    Declaration

    Swift

    func suffix(startAt: Int) -> String

    Parameters

    startAt

    The start character of elements to get the suffix string.

    Return Value

    Returns a substring

  • Calculates the string height based on UIFont

    Declaration

    Swift

    func height(withConstrainedWidth width: CGFloat, font: UIFont) -> CGFloat

    Parameters

    width

    the UIView width

    font

    the UIFont

    Return Value

    the String height

  • Format amount to double

    Declaration

    Swift

    func formatAmountToDouble() -> Double

    Return Value

    double value

  • Get FX Rate with four decimal

    Declaration

    Swift

    func getFxRateWithFourDecimal() -> String

    Return Value

    return string with four decimal

  • Format amount for currency code using users locale

    Declaration

    Swift

    func formatToCurrency(with currencyCode: String?) -> String

    Parameters

    currencyCode

    currency code

    Return Value

    a formatted amount string