I have to make dynamic replacement into HTML files on iOS App.
It s about localisation.
in the HTML files, I ve got things like : LANG(183) which must be turned into “a localized string”
I was looking at stringByreplacingMatchesInString but cant find any version that accept a callback function? do I miss something ?
You could use a block-based matching method of
NSRegularExpression:(As far as I know) you must not modify
htmlStringinside the block. Therefore you have to create a mutable copy first which you can modify in the block.Of course, you have to keep track of changes in the length of
newString, because the matching range will always refer tohtmlString.