<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Dec 10, 2015, at 1:50 PM, Harlan Haskins via swift-users &lt;<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">I’m not sure what happened to <font face="Menlo" class="">String(format:)</font>, but I haven’t been able to get it to work either.<div class="">It’s printing its argument as a tuple.</div></div></div></blockquote><div><br class=""></div><div>I believe that String(format:) is implemented differently on Linux due to lack of ObjC/Foundation. This is a subtlety.</div><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><br class=""></div><div class="">I think variadic functions aren’t implemented in the dev version of Swift?</div></div></div></blockquote><div><br class=""></div><div>Correct, vararg C functions don’t get imported into Swift.</div><div><br class=""></div><div>- mish</div><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><br class=""></div><div class=""><div class=""><font face="Menlo" class="">main.swift:3:1: error: 'printf' is unavailable: Variadic function is unavailable</font></div><div class=""><font face="Menlo" class="">printf("%0.2d", 4.555555555)</font></div><div class=""><font face="Menlo" class="">^~~~~~</font></div><div class=""><font face="Menlo" class="">SwiftGlibc.printf:2:13: note: 'printf' has been explicitly marked unavailable here</font></div><div class=""><font face="Menlo" class="">public func printf(__format: UnsafePointer&lt;Int8&gt;, _ varargs: Any...) -&gt; Int32</font></div></div><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Dec 10, 2015, at 4:39 PM, Isaac Gouy via swift-users &lt;<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div class=""><br class="">For example,<br class=""><br class=""> &nbsp;&nbsp;print( String(format: "%.3f", 1.23489) )<br class=""><br class=""> &nbsp;&nbsp;$ /usr/local/src/swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu15.10/bin/swiftc test.swift<br class=""><br class=""> &nbsp;&nbsp;$ ./test<br class=""> &nbsp;&nbsp;("%.3f", 1.23489)<br class=""><br class="">Not 1.235<br class="">_______________________________________________<br class="">swift-users mailing list<br class=""><a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-users" class="">https://lists.swift.org/mailman/listinfo/swift-users</a><br class=""></div></div></blockquote></div><br class=""></div>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=xTF6JWnt2pl7kNka7081D3VajDoXFZTI5JEuSuQLncrbYtmQ9W0phSa2s2pOqQmAbWQY-2BaJIiUgcmPkOTop5tlDFlAJhngC8eaFHRH4pyyFvenC8VVQZdKCsKnmk5Tcd-2FyJ3oKPnIARYCiwdfLvWzfAN9a-2BjCZGSMB2I69WZr9fDepmkBE6ZRT5o2baleutFWNp57rOBO0hHMOzRNAB1Q-2FGqoOpO2RgacDUrV9g2bnc-3D" alt="" width="1" height="1" border="0" style="height:1px !important;width:1px !important;border-width:0 !important;margin-top:0 !important;margin-bottom:0 !important;margin-right:0 !important;margin-left:0 !important;padding-top:0 !important;padding-bottom:0 !important;padding-right:0 !important;padding-left:0 !important;" class="">
</div>
_______________________________________________<br class="">swift-users mailing list<br class=""><a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-users<br class=""></div></blockquote></div><br class=""></body></html>