这是我的数组
["<h2>Some text, and some info.</h2>", "<h2>Another text</h2>"]
字符串
我得让它看起来像这样
<h2>Some text, and some info.</h2><h2>Another text</h2>
型
我需要删除["
", "
"]
尝试extension
在[String]
数组上调用replcaingOccurances
extension Array where Element == String {
func replacingOccurrences(of target: String, with replacement: String, options: NSString.CompareOptions) -> Self
{
return self.map( { $0.replacingOccurrences(of: target, with: replacement, options: options) } )
}
}
型
背景:我正在Core Data
中的array
中保存html
数据
尝试使用扩展名不会过滤任何事件
let result = ResultCoreDataManager.sharedInstance.getResults()
let filtered = result?.replacingOccurrences(of: "<[\"\"]\",\"\", \"", with: "", options: .regularExpression)
型
帮帮忙?
1条答案
按热度按时间svmlkihl1#
它是一个有两个元素的字符串数组,那么为什么不直接使用
joined
呢?字符串