I'm building a web application and getting some descriptions from the server. Those strings that I'm getting sometimes include specific characters in them, which should be replaced with proper values. An example of the string looks like this:
let str = 'Every next purchase provides you with additional %@ days
of bonuses, up to %@ days.'
I need to replace '%@' with proper values. Probably the best way to get those values is an array, since text may have one '%@' or more. I've been thinking about dealing with this through substring method, but I'm not sure if that's the best way.
Example of values may be like [2,5].
Then result should looks like:
'Every next purchase provides you with additional 2 days
of bonuses, up to 5 days.'
Thanks for any help.