Post Reply 
(50g) String inside string manipulation, UserRPL
10-18-2016, 07:43 AM (This post was last modified: 10-18-2016 07:47 AM by Vtile.)
Post: #14
RE: (50g) String inside string manipulation, UserRPL
(10-18-2016 01:41 AM)DavidM Wrote:  Why not simply store the list of items in a global variable, then populate the required parameters from that variable? Instead of hard-coding the list of items into the key assignment, you would simply RCL that list into place before calling CHOOSE. That would keep you from having to update the key assignment program every time, since its contents would never change. You'd still have to change the global variable to represent the newest items, though. But since the program itself wouldn't change, the key assignment stays intact.
Yep, it is the best solution to use global variable for data and then update it instead of the program itself and I have one of those in use. Even though only storing the object number of previously selected object so the default selection is always the last used one.

Mmmh. I were so sure I finally nailed the string part when creating this thread, but last evening I though there is problem with certain more complex strings that contains another program elements, propably it were uneven number of quotation marks that coused the issue. I'm using not so good testing method, doing it only in calculator, so I need to start to store the snippets before using them to get more precise results and possibility to analyse the outcome better.

(10-18-2016 01:41 AM)DavidM Wrote:  As for making a program out of strings, you can still add the opening and closing brackets with the CHR methodology mentioned previously, or simply enclosing those characters in double quotes:

Code:
« "«" 34 CHR "Vtile" 34 CHR "»" + + + + STR→ »
or
Code:
« 171 CHR 34 CHR "Vtile" 34 CHR 187 CHR + + + + STR→ »

It's always possible that I'm still misunderstanding the issues, though. Smile
I ended up to similar solution and found following small program to be handy to convert a string to a program object. It doesn't preserve the quotation marks, since at that point I haven't noticed the "34 CHR" instruction for a reason or another.
Code:
/<< 
"/>>" + "/<<" SWAP + OBJ/-> 
/>>

I test (the supposed problem) more this evening to see if it were my typo or does the program and system really behave as I think atm. it behaves.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: (50g) String inside string manipulation, UserRPL - Vtile - 10-18-2016 07:43 AM



User(s) browsing this thread: 1 Guest(s)