Last active
February 8, 2021 00:58
-
-
Save bi119aTe5hXk/17da12638ba086cc5c815d9526978eae to your computer and use it in GitHub Desktop.
Replace texts using swift playground
This file contains 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
import Cocoa | |
import PlaygroundSupport | |
let path = Bundle.main.path(forResource: "api", ofType: "html") | |
var htmlString = try? String(contentsOfFile: path!, encoding: .utf8) | |
//print(htmlString) | |
//public let replaceTexts = ["org text": "replaced text"] | |
for _ in 1...100 { | |
for (key,value) in replaceTexts { | |
htmlString = htmlString!.replacingOccurrences(of: key, with: value) | |
} | |
} | |
print(htmlString!) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment