While I was trying to use Swift's String(format: format, args)
method, I found out that I cannot print the formatted string directly without newline(\n
) and brackets being added.
So for example, I have a code like this:
func someFunc(string: String...) {
print(String(format: "test %@", string))
}
let string = "string1"
someFunc(string, "string2")
the result would be:
"test (\n string1,\n string2\n)\n"
However, I intend to deliver the result like this:
"test string1 string2"
How can I make the brackets and \n
not being printed?