ReplaceList problem using <crlf> as separator

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
klownboy
Posts: 4462
Joined: 28 Feb 2012 19:27
Location: Windows 11, 25H2 Build 26200.8737 at 100% 2560x1440

ReplaceList problem using <crlf> as separator

Post by klownboy »

Hi, I've been working on a script which using SC replacelist which I've used numerous times but typically with a "|" separator. With this script however I'm using "<crlf>" and replaceList is not working. There are a number of others ways I've already scripted to get the result not using SC ReplaceList, but it was still driving me nuts. So I tried a simpler replacelist example using bogus info - one using "|" as a separator and the other with identical strings using "<crlf>". The <crlf> version does not work - at least not for me. The variable returned is simply the inputted string. Try this simple replacelist script. Is this a bug or is there something different I should be doing when using "<crlf>" vs. "|"? Thanks.

Code: Select all

  step;
  $LM_names = "pie|pizza|fork|spoon";
  $LM_cids = "14|28|56|112";
  $sel_name = "pizza";

 $sel_cid = replacelist($sel_name, $LM_names, $LM_cids, "|"); echo $sel_cid;  // 28 as it should

  $LM_names = "pie<crlf>pizza<crlf>fork<crlf>spoon";
  $LM_cids = "14<crlf>28<crlf>56<crlf>112";
  $sel_name = "pizza";

 $sel_cid = replacelist($sel_name, $LM_names, $LM_cids, "<crlf>"); echo $sel_cid;  // pizza as it shouldn't
   unstep;

PeterH
Posts: 2827
Joined: 21 Nov 2005 20:39
Location: DE W11Pro 24H2, 1920*1200*100% 3840*2160*150%

Re: ReplaceList problem using <crlf> as separator

Post by PeterH »

Interesting usage :shock:
(To see such constructs is one reason for me to read here so much :ugeek: )

I think you are right: second example should work like first.

By the way (sorry :P ) <crlf> is a "variable" (though constant) and can be used unquoted. Sure: double quotes are allowed.
So as a single operand: <crlf>, while in concatenation to strings your "pie<crlf>pizza<crlf>fork<crlf>spoon" is best.

klownboy
Posts: 4462
Joined: 28 Feb 2012 19:27
Location: Windows 11, 25H2 Build 26200.8737 at 100% 2560x1440

Re: ReplaceList problem using <crlf> as separator

Post by klownboy »

Thanks PeterH for checking. I kept thinking I was doing something wrong (which is not that unusual when it comes to scripting). So I wasn't sure if it was a bug. The real script has the replacelist within a foreach loop obtaining the replacement values from a list of about 25 Command IDs based on the command names selected in with an inputselect command and then catenating the cids.

admin
Site Admin
Posts: 66323
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: ReplaceList problem using <crlf> as separator

Post by admin »

Yep, :bug: . Fix comes.

klownboy
Posts: 4462
Joined: 28 Feb 2012 19:27
Location: Windows 11, 25H2 Build 26200.8737 at 100% 2560x1440

Re: ReplaceList problem using <crlf> as separator

Post by klownboy »

I just tested the beta and it works great. Thanks Don.

Post Reply