Decimal
public extension Decimal
-
Returns a rounded version of the decimal number using plain rounding mode and 2 fraction digits.
Declaration
Swift
var rounded: Decimal { get }
-
Returns a rounded version of the decimal number using the specified rounding specification.
Declaration
Swift
func rounded(roundingMode: NSDecimalNumber.RoundingMode, scale: Int16) -> Decimal
Parameters
roundingMode
The rounding mode to use.
scale
The number of digits a rounded value should have after its decimal point.
Return Value
A rounded version of the decimal number.
-
Return a string description of this number with 2 maximum fraction digits.
Declaration
Swift
var string: String? { get }
-
Returns a string containing the formatted value of the decimal number.
Declaration
Swift
func string(minimumFractionDigits: Int = 0, maximumFractionDigits: Int) -> String?
Parameters
minimumFractionDigits
Default value is 0.
maximumFractionDigits
The maximum number of digits after the decimal separator.
Return Value
A string containing the formatted value of the decimal number.