I’m still quite not sure what you mean. If you want to do the string replacement inside the map function then I would say you can’t (according to your example).
Replace is a function for strings and map is a function for arrays so you cannot just combine them because they’re based on different base types and both target different purposes.
What it is the problem with your existing code?