相关疑难解决方法(0)

如何在swift中解码HTML实体?

我从一个站点提取一个JSON文件,其中一个字符串是:

The Weeknd ‘King Of The Fall’ [Video Premiere] | @TheWeeknd | #SoPhi 
Run Code Online (Sandbox Code Playgroud)

如何将事物&#8216转换为正确的字符?

我已经制作了一个Xcode Playground来演示它:

import UIKit

var error: NSError?
let blogUrl: NSURL = NSURL.URLWithString("http://sophisticatedignorance.net/api/get_recent_summary/")
let jsonData = NSData(contentsOfURL: blogUrl)

let dataDictionary = NSJSONSerialization.JSONObjectWithData(jsonData, options: nil, error: &error) as NSDictionary

var a = dataDictionary["posts"] as NSArray

println(a[0]["title"])
Run Code Online (Sandbox Code Playgroud)

json html-entities swift

113
推荐指数
10
解决办法
5万
查看次数

标签 统计

html-entities ×1

json ×1

swift ×1