Search
 
SCRIPT & CODE EXAMPLE
 

SWIFT

numberformatter swift

let currencyFormatter = NumberFormatter()
currencyFormatter.usesGroupingSeparator = true
currencyFormatter.numberStyle = .currency
// localize to your grouping and decimal separator
currencyFormatter.locale = Locale.current

// We'll force unwrap with the !, if you've got defined data you may need more error checking
let priceString = currencyFormatter.string(from: 9999.99)!
print(priceString) // Displays $9,999.99 in the US locale
Comment

PREVIOUS NEXT
Code Example
Swift :: navigationbar large title swift 
Swift :: swift iterate over a dictionary 
Swift :: Module compiled with Swift 5.3 cannot be imported by the Swift 5.3.1 compiler 
Swift :: swift add programmatically width height constraint to view 
Swift :: view controller modal fullscreen programmatically swift 5 
Swift :: Swift Swift continue statement with nested loops 
Swift :: swiftui create search bar 
Swift :: how to remove item from list swift 
Swift :: How to hide view in swiftui 
Swift :: concatenate string swift 
Swift :: swift pdf thumbnail 
Swift :: swift iterate through string 
Swift :: socket io swift 
Swift :: initialize array with zero in swift 
Swift :: swift check if array values are equal 
Swift :: did select row at 
Swift :: float vs double in swift 
Swift :: swift initialize array with size 
Swift :: swift reload view 
Swift :: repeat...while Loop Swift 
Swift :: Log httpurlresponse swift 
Swift :: Swift Named Tuple 
Swift :: swift if let 
Swift :: special symbol ios swift 
Swift :: helen joseph 
Swift :: struct exsmple 
Swift :: key path expression as functions ios swift 
Swift :: print 1 line swift 
Swift :: how to know when text changed textfield swiftui 
Ruby :: A Ruby write to file example 
ADD CONTENT
Topic
Content
Source link
Name
1+2 =