【发布时间】:2017-06-15 13:34:21
【问题描述】:
我的代码 sn-p 是:
unwanted = " £€₹jetztabfromnow"
let favouritesPriceLabel = priceDropsCollectionView.cells.element(boundBy: UInt(index)).staticTexts[IPCUIAHighlightsPriceDropsCollectionViewCellPriceLabel].label
let favouritesPriceLabelTrimmed = favouritesPriceLabel.components(separatedBy: "jetzt").flatMap { String($0.trimmingCharacters(in: .whitespaces)) }.last
favouritesHighlightsDictionary[favouritesTitleLabel] = favouritesPriceLabelTrimmed
我的问题是,这不起作用:
let favouritesPriceLabelTrimmed = favouritesPriceLabel.components(separatedBy: unwanted).flatMap { String($0.trimmingCharacters(in: .whitespaces)) }.last
我的价格类似于“3,95 €” - 我想减少所有货币“£€₹”和“from”或“ab”之类的词
你有什么解决方案吗,我可以在这里使用什么?
【问题讨论】:
-
这个字符串有固定的语言环境吗?
-
无。它可以在更多语言环境之间更改。
标签: ios swift3 character-trimming