<html><head><style type='text/css'>p { margin: 0; }</style></head><body><div style='font-family: times new roman,new york,times,serif; font-size: 12pt; color: #000000'>Hello,<div><br></div><div>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:</div><div><br></div><div><div>float f=0.0;</div><div>string s = @sprintf("%.2f", f);</div></div><div><br></div><div><span style="font-size: 12pt;">Execution failed:</span></div><div><div><span class="Apple-tab-span" style="white-space:pre">     </span>tracef(): Unknown format: %.</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>swiftscript:sprintf, test.swift, line 2</div><div><span class="Apple-tab-span" style="white-space:pre">      </span>assignment, test.swift, line 3</div></div><div><br></div><div>David</div></div></body></html>