Created
November 10, 2016 18:33
-
-
Save wess/62df79978a76bdecca194821991bf65c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func removeHTML(_ str:String) -> String { | |
var html = str | |
let scanner = NSScanner(string: html) | |
var text:NSString? = "" | |
while !scanner.atEnd { | |
scanner.scanUpToString("<", intoString: nil) | |
scanner.scanUpToString(">", intoString: &text) | |
if let replaceText = text as? String { | |
html = html.stringByReplacingOccurrencesOfString("\(replaceText)>", withString: "") | |
} | |
} | |
return html | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment