> On Dec 10, 2015, at 1:50 PM, Harlan Haskins via swift-users
> <[email protected]> wrote:
>
> I’m not sure what happened to String(format:), but I haven’t been able to get
> it to work either.
> It’s printing its argument as a tuple.
I believe that String(format:) is implemented differently on Linux due to lack
of ObjC/Foundation. This is a subtlety.
>
> I think variadic functions aren’t implemented in the dev version of Swift?
Correct, vararg C functions don’t get imported into Swift.
- mish
>
> main.swift:3:1: error: 'printf' is unavailable: Variadic function is
> unavailable
> printf("%0.2d", 4.555555555)
> ^~~~~~
> SwiftGlibc.printf:2:13: note: 'printf' has been explicitly marked unavailable
> here
> public func printf(__format: UnsafePointer<Int8>, _ varargs: Any...) -> Int32
>
>> On Dec 10, 2015, at 4:39 PM, Isaac Gouy via swift-users
>> <[email protected] <mailto:[email protected]>> wrote:
>>
>>
>> For example,
>>
>> print( String(format: "%.3f", 1.23489) )
>>
>> $ /usr/local/src/swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu15.10/bin/swiftc
>> test.swift
>>
>> $ ./test
>> ("%.3f", 1.23489)
>>
>> Not 1.235
>> _______________________________________________
>> swift-users mailing list
>> [email protected] <mailto:[email protected]>
>> https://lists.swift.org/mailman/listinfo/swift-users
>
>
> _______________________________________________
> swift-users mailing list
> [email protected]
> https://lists.swift.org/mailman/listinfo/swift-users
_______________________________________________
swift-users mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-users