I am working on Swift 4.
The requirement: I have a string:
var inputString = "Today is very bright day"
I have a file containing key value pairs for strings.
{
"Birthday": ["brand day", "burn day", "bright day", "brick daya"],
"Temporary": ["tempora", "temporar", "tempura"]
}
The math needed: In the app, if the inputString is "Today is very bright day", I need to check if this string contains any of the values from the key-value pair file and replace the occurrence with the key.
e.g: In above example: inputString = "Today is very bright day"
match it with the file.
replace bight day with birthday so that the inout string becomes
inputString = "Today is very birthday".
Is there any way to do this? The key-value file could be big.