News:

MultiCommander v16.6 is released!

Main Menu

StrReplace

Started by pncdaspropagandas, February 02, 2017, 18:46:49

Previous topic - Next topic

pncdaspropagandas

In a MultiScript when I run

$python_script_path = StrReplace($python_script_path, '"', 'x');
it runs fine

but if I run
$python_script_path = StrReplace($python_script_path, '"', '^"');
it reports an error to Log Window

further, If I create a var with '^"' and use it like
$python_script_path = StrReplace($python_script_path, '"', $aux);
it runs fine also

I think there's something wrong there

Mathias (Author)

#1
I have not check it yet
But I think you need to escape special character like "
StrReplace($python_script_path, '"', "^\"");

And you need to use double quotes..  single quotes are used for paths where you do not want it to escape characters..

http://multicommander.com/docs/multiscript/languagesyntax#escseq

pncdaspropagandas

I tried to use
$python_script_path = StrReplace($python_script_path, "\"", "^\"");

but the Log Window reports:
2017-02-02 16:55:30.623 Script engine error - Line : 18, Error : -1 => Code : "$python_script_path = StrReplace($python_script_path, "\"", "^\"")"

Mathias (Author)

But it worked if you defined it to a variable? Then probably the parser gets confused with all the "
You can try to encapsulated the constant string in parentheses since then they are evaluated first.
Or just use variables.



pncdaspropagandas

Yes, it worked when I defined to a variable.
I'm using this way.

Thanks!

Sharoun

#5
Quote from: Mathias (Author) on February 02, 2017, 19:23:53
I have not check it yet
But I think you need to escape special character like "
StrReplace($python_script_path, '"', "^\"");

And you need to use double quotes..  adeleweightloss.com single quotes are used for paths where you do not want it to escape characters..

http://multicommander.com/docs/multiscript/languagesyntax#escseq
I'm using this way.