删除修剪特殊字符

时间:2016-06-08 13:40:30

标签: ios swift

我一直试图修剪和删除字符:

{
    "data":
    {
        "is_silhouette": false, 
        "url": "https://scontent.xx.fbcdn.net/v/t1.0-1/p50x50/13254063_1039990606071446_7680951628744860479_n.jpg?oh=e5088fb1a981041f60c9abde6762d892&oe=57C12344"
    }
} 

并将其转换为:

https://scontent.xx.fbcdn.net/v/t1.0-1/p50x50/13254063_1039990606071446_7680951628744860479_n.jpg?oh=e5088fb1a981041f60c9abde6762d892&oe=57C12344

这是我的代码:

let dataStore = backend.persistenceService.of(Users.ofClass())
    dataStore.find(
        { ( users : BackendlessCollection!) -> () in
            print("Users have been fetched  (ASYNC): \(users)")
            let page = users.getCurrentPage()
            for userx in page {
                print(userx.picture)
            }

        },
        error: { ( fault : Fault!) -> () in
            print("Server reported an error (ASYNC): \(fault)")
        }
    )

1 个答案:

答案 0 :(得分:0)

好像你正在阅读回复。

您想要的网址和响应网址都相同。

因此无需修剪它,您可以使用 valueForKey objectForKey 方法直接从响应中获取网址。

var URL: String = data.valueForKey("URL") as? String