Swift - 标签字段中的奇怪输出

时间:2015-03-17 09:09:00

标签: ios swift

let path = NSBundle.mainBundle().pathForResource("file", ofType: "log")
var text = String(contentsOfFile: path!, encoding: NSUTF8StringEncoding, error: nil)!

var textArr = text.componentsSeparatedByString("\n")
            var rad: String = textArr[n]
....

println(rad)
label.text = "\(label.text) \(rad)"

在Xcode Output窗口中,我得到了这个:

CORRECT LINE 
NEXT LINE

在模拟器中的标签字段中,我得到了这个:

Optional("Optional("Optional(\\\"\\\")
CORRECT LINE\\r\") NEXT LINE \r")

我希望标签字段看起来像Xcode中的输出,所有这些可选的\\" r -stuff来自哪里?

0 个答案:

没有答案