Skip to content

Glossary: Swift Basics

String(format:)

Also written: %.2f

A Foundation tool that builds a string from a number in a set layout; `String(format: "%.2f", total)` gives exactly two digits after the point, as for money.

Where the book teaches it

Related terms

Foundationstring interpolation