Hello,
In an entity, I want to store strings that contain variables. Once these strings are fetched, I want to be able to process the variables. In C#, you could use string interpolation to store the string like “… {0} …”, and then once it's fetched, use the String.Format() method to pass in the variables. Is there something similar in Outsystems, or is there perhaps another approach I can use to achieve my goal?
Thank you
Hi Roberto,
That's not that a rare scenario in OutSystems and you can use Regular expressions to do that. In your dependencies, on the Text extension you will find Regex_Replace action to replace patterns in a string.
You can also take a look at Regex How To forge component on how to use it and test it both client and server side.
See here an example ran in the component forge sandbox that uses the Regex_Replace action and that replaces in the string the pattern {1} (the \ is to escape the special character { ):
Hope it helps.
Regards,
João
Thanks João!
Hi,
You can user Mustache JS for this (https://github.com/janl/mustache.js)
Just put mustache js to your script in the application and trigger using javascript syntax
Mustache.render