字符串(格式:在Swift中不使用带编号的参数?

时间:2016-01-01 17:38:35

标签: ios swift string-formatting

来自Java世界,我很放心在文档中看到编号参数有格式化支持,所以如果我有以下字符串格式:

String(format:"%1$s drew from the %3$s pile and discarded the %4$s", name, pickedUp, pile, discard)

我希望: Droid drew from the Draw pile and discarded the KS (忽略第二个参数,即拾取卡)

但我真正得到的是: Droid drew from the 5C and discarded the Draw

好像完全忽略了编号参数。我做错了什么?

0 个答案:

没有答案