HTML Format in UITextView

前端 未结 8 1094
轻奢々
轻奢々 2020-12-01 07:19

i\'m quite new to iOS Development and right now working on an app which receive some kind of JSON Data. But some Backend Experts thought, that it would be better for the Use

8条回答
  •  -上瘾入骨i
    2020-12-01 07:34

    Another way I used to do this :

    var someHtmlString = "Für mehr Informationen klicken sie here."
    let regex = try! NSRegularExpression(pattern: "<.*?>", options: [.CaseInsensitive])
    let range = NSRange(location: 0, length: someHtmlString.characters.count)
    let htmlLessString: String = regex.stringByReplacingMatchesInString(someHtmlString, options: NSMatchingOptions(), range:range, withTemplate: "")
    

    End result -> htmlLessString is

    "Für mehr Informationen klicken sie here."
    

提交回复
热议问题