swift 3
我试图将XML文件的内容写入磁盘,但我所有的单个引号最终看起来都像& apos ,而不是'。我需要做什么才能撰写单个引号?
在此XML文件中,字符串始终以单个引号封闭,并且数组分开。
这是书写时必须看起来的名称的方式:
<names value="'Fred', 'Wilma', 'George'"/>
这就是我得到的
<names value="'Fred','Wilma','George'/>
已解决
Martin R的提醒就是我需要找出一种处理这种情况的方法。
我刚将XML视为字面弦并使用了蛮力。
let newXML = xmlAsString.replacingOccurrences(of: "'", with: "'")
谢谢!