我有一个如下所示的字典,我需要删除键中的 $ 符号,并且需要存储在具有相同数据的单独数组中,如此处所示有人可以帮助我如何从所有键中删除美元吗?
var products = ["$50-$60": 50-60, "$30-$40": 30-40, "$0-$10": -10, "$20-$30": 20-30, "$90-and above": 90-, "$40-$50": 40-50, "$80-$90": 80-90, "$70-$80": 70-80, "$10-$20": 10-20, "$60-$70": 60-70]
Best Answer-推荐答案 strong>
据我所知,我希望你想要数组中的一组键
var dollarRemovedArray = products.map{$0.key.replacingOccurrences(of: "$", with: "")}
输出会是这样--
["50-60", "30-40", "0-10", "20-30", "90-and above", "40-50", "80-90",
"70-80", "10-20", "60-70"]
关于ios - 如何从 swift 3 中的键值对中删除符号?,我们在Stack Overflow上找到一个类似的问题:
https://stackoverflow.com/questions/46462677/
|