I have an array of strings, within each string I want to call a variable
Strings = ["$username thanks for visiting","Thanks $username, but I don't understand the command $userProvidedCommand"]
now I know I can use string replace
msg.replace('$username', userame)
however I don't want to write a string replace for every possibility.
what would be ideal , I think. would be to have have some sort of pattern replacement where it looks for the $ and breaks the string up and concatenates it back together with the variable.
Is there a way to do that, or maybe there is a better solution ?
thanks