I am learning solidity string/byte manipulation and I am trying to create a Solidity function that finds specific words in a string/format and replaces them with given variables to return "edited" string
Example:
string format = "UserData: {address}, {balance}"
function replaceWords(string calldata Format) external pure returns (string memory){
address addr = 0x8599fed66e2a440f12e9bc3fcf40594af78f3694;
unit balance = 100;
string memory editedString;
// Function logic
return editedString //Returns "UserData: 0x8599fed66e2a440f12e9bc3fcf40594af78f3694, 100"
}
The function should also work if the "format" is arranged differently. Example: "UserData: {balance}, {address}" ---> returns: "UserData: 100, 0x8599fed66e2a440f12e9bc3fcf40594af78f3694"
I did find some similar examples but I am not 100% sure how should I approach this.
solidity-how-to-replace-specific-string-position-with-letter
Any help would be appreciated.