Skip to content

Double Extensions

Marco Quinten edited this page Feb 28, 2021 · 2 revisions
/// Returns a string representing the receiver.
///
/// - Remark: String() does not support optional chaining.
var toString: String

/// Returns a string representing the receiver, respecting the current locale.
///
/// - Parameters:
///   - decimals: The maximum number of decimals to display. Standard rounding is applied. The default is `2`.
///   - separatesThousands: Whether thousands should be separated according to the current locale.
///   - locale: The locale to be used for formatting.
func toFormattedString(
  decimals: Int = 2,
  separatesThousands: Bool = true,
  locale: Locale = .autoupdatingCurrent
) -> String

Clone this wiki locally