1 person found this helpful
Check the following snippet which shows how all dot characters ('.') in a string can be replaced with newline characters ('\n').
var x = "aaaaaa.bbbbbbb.ccccc.ddddd"; System.log("original value: " + x); var y = x.replace(/\./g, "\n"); System.log("formatted value: " + y);
If you're sending a HTML email (as opposed to text) you'll want to replace them with <br /> and not the newline character.
const body = myVar.replace(/\./g, '<br />');