aotian16 aotian16 - 1 year ago 119
Swift Question

how to use separator param of print in swift2

Sorry for newbee question.

I really do not know how to use separator param in print

var str = "Hello, playground"
var strs = ["abc","def"]

print(strs, separator: ",", terminator: "")
print(str, separator: ",", terminator: "\n")

Answer Source

print accepts its arguments separately, so you can do this:

print("abc", "def", separator: ",")

But you have an array of strings, so you should do this:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download