<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix"><br>
The current function does not do this. My thought was it is good
to be able to represent Swift-specific types. But it would also
be good to have a function that simply uses Java's
String.format(). <br>
<br>
On 04/04/2013 05:41 PM, David Kelly wrote:<br>
</div>
<blockquote
cite="mid:1199631010.4499154.1365115276436.JavaMail.root@ci.uchicago.edu"
type="cite">
<style type="text/css">p { margin: 0; }</style>
<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>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Swift-devel mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Swift-devel@ci.uchicago.edu">Swift-devel@ci.uchicago.edu</a>
<a class="moz-txt-link-freetext" href="https://lists.ci.uchicago.edu/cgi-bin/mailman/listinfo/swift-devel">https://lists.ci.uchicago.edu/cgi-bin/mailman/listinfo/swift-devel</a>
</pre>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">--
Justin M Wozniak
</pre>
</body>
</html>