Multi Commander Support Forum

Multi Commander => Support and Feedback => Topic started by: pncdaspropagandas on February 02, 2017, 18:46:49

Title: StrReplace
Post by: pncdaspropagandas on February 02, 2017, 18:46:49
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
Title: Re: StrReplace
Post by: 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..  single quotes are used for paths where you do not want it to escape characters..

http://multicommander.com/docs/multiscript/languagesyntax#escseq
Title: Re: StrReplace
Post by: pncdaspropagandas on February 02, 2017, 19:53:01
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, "\"", "^\"")"
Title: Re: StrReplace
Post by: Mathias (Author) on February 02, 2017, 21:16:03
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.


Title: Re: StrReplace
Post by: pncdaspropagandas on February 03, 2017, 10:56:27
Yes, it worked when I defined to a variable.
I'm using this way.

Thanks!
Title: Re: StrReplace
Post by: Sharoun on February 05, 2017, 21:00:12
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 (http://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.