Hi Jozef,
my doubts about $replace() were definitively wrong...
I have created a simple button having into <DETAIL> the following code:
variables
string cCR
string vTextIni, vTextFin
raw vRaw, vRawClean, vMultiZeroBin, vSingleZeroBin
endvariables
; Initialize few variables...
cCR = "%%^"
vTextIni = $concat("It's a long way to Tipperary,", cCR, "It's a long way to go.", cCR, $concat("It's a long way to Tipperary", cCR, "To the sweetest girl I know!", cCR))
vTextFin = $concat("Goodbye Piccadilly,", cCR, "Farewell Leicester Square!", cCR, $concat("It's a long long way to Tipperary,", cCR, "But my heart's right there.", cCR))
vMultiZeroBin = $decode("HEX", "000000000000000000000000")
; Build a RAW string simulating what Josef has loaded as XML
vRaw = $concat(vTextIni, vMultiZeroBin, vMultiZeroBin, cCR, vTextFin)
; Dump it to disk to be read later on with Notepad++
filedump/raw vRaw, "myFileRaw.txt"
; ========== =========== =========== =========== =========== ===========
; Initialize single binary zero
vSingleZeroBin = $decode("HEX", "00")
; Replace binary zero in the raw string
vRawClean = $replace(vRaw, 1, vSingleZeroBin, "", -1)
; Dump the result to disk to be read with Notepad++
filedump/raw vRawClean, "myFileRawClean.txt"
; Let's clean empty lines too...
vRawClean = $replace(vRawClean, 1, $concat(cCR, cCR), cCR, -1)
filedump/raw vRawClean, "myFileRawNoEmptyLines.txt"
; ========== =========== =========== =========== =========== ===========
message/info "Done!"
After executing open into Notepad++ the three files dumped to disks.
...et voilà!
Regards,
Gianni