[Swift-devel] Formatting floats
David Kelly
davidk at ci.uchicago.edu
Thu Apr 4 17:41:16 CDT 2013
Hello,
Is it possible to format floats in a printf() like way in Swift? I tried using @sprintf to print to two decimal places, but it doesn't seem to do what I want:
float f=0.0;
string s = @sprintf("%.2f", f);
Execution failed:
tracef(): Unknown format: %.
swiftscript:sprintf, test.swift, line 2
assignment, test.swift, line 3
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/swift-devel/attachments/20130404/8b3aaafa/attachment.html>
More information about the Swift-devel
mailing list