Change amounts to dropping "\" from list of special characthers and dropping the if-statement (which seems unnecessary). Maybe the @wfind, which should return position of character, doesn't work (Haven't checked).
Yes. @wfind should be replaced to @instr when we want to find the position of characters.
However, as you mentioned, the step to check whether special characters are found can be ignored.
About dropping "\". If the code encounters "\" then it would create "\\" which is a linebreak, which is not what you want. I'm not sure you really will use "\" that often that it is a big problem. If you want "\" in the list you have to add a special condition for that character (I think).
We can keep the list for special characters by adding an additional condition - i.e.
if %cha =
"\" then - as follows.
Code: Select all
%special = "# & % $ _ { } \ ~ ^"
for !r=1 to !nrows
for !c=1 to !ncols
%temp = {%tbl}(!r,!c)
for !i=1 to @wcount(%special)
%cha = @word(%special,!i)
if %cha = "\" then
%temp = @replace(%temp, %cha, "$\backslash$")
else
%temp = @replace(%temp, %cha, "\" + %cha)
endif
next
...