Is there a built-in method to escape special characters in a string, in a similar way to what is done by Portal with global data ?
If a global node contains special characters, (eg : a line returns), it will be displayed like this in Portal ("System > Globals > View Global Data" panel) :
^A(1) = "this is"_$c(13,10)_"a test"
I would like to export global data to a txt file using a similar format.
I already wrote the main code (that loops on all nodes and dump them to file), the problem is how to handle special characters.
For the moment I replace them manually one by one. It works, but it's far from perfect :
set text = ... //get global data
set text = $replace(text,"""","""""") //double the quotes
set text = $replace(text,$c(13),"""_$c(13)_""")
set text = $replace(text,$c(10),"""_$c(10)_""")
...
Is there a built-in function in cache that handle special characters in a string by splitting it into smaller strings (with concatenation in between), something similar what Portal does ?
Or even better : a built-in function that can export a global to a txt file directly, in a format similar to Portal.