Post Reply 
how to remove string?
05-31-2018, 06:44 PM
Post: #1
how to remove string?
hello boys,

how could i remove the string

example:
"hp_prime" >>>> hp_prime
Find all posts by this user
Quote this message in a reply
06-01-2018, 04:56 AM
Post: #2
RE: how to remove string?
Hello,

When you see "hp_prime", it means that you have a string object that contains the text hp_prime.
The double quote is not part of the string... it is an indicator... So you can not "remove" it...

If what you want to do is display the content of the string on the screen, depending on what you want to do exactly, you could use the textout_p or print functions...

If you want to convert that string into another object (for example, if your string contains the name of a variable and that you want to get the content of this variable), you could use expr...

Please tell us more...

Cyrille

Although I work for the HP calculator group, the views and opinions I post here are my own. I do not speak for HP.
Find all posts by this user
Quote this message in a reply
06-01-2018, 06:48 AM
Post: #3
RE: how to remove string?
I CAN NOT MODIFY THE USER VARIABLES

[img]https://ibb.co/dFjTNd https://ibb.co/jPLPvy https://ibb.co/jfMWay https://ibb.co/gMhtoJ https://ibb.co/jSRa2d https://ibb.co/n2W8Nd[/img]
Find all posts by this user
Quote this message in a reply
06-01-2018, 04:55 PM
Post: #4
RE: how to remove string?
CREATE USER VARIABLES
[Image: 20180601114656.png]
MY PROGRAM: edit the objects in the lists
DAT1;
DAT2;

EXPORT PREGUNTA(Y,D)
BEGIN

PRINT;
DAT1:=EXPR("YEAR_"+Y+"_DAY_"+D); // LIST
DAT2:=EVAL("'YEAR_"+Y+"_DAY_"+D+"'"); // NAME LIST

PRINT(DAT2)+PRINT(DAT1);
wait(3);

EDITLIST(DAT1);

END;

example
[Image: 20180601114823.png]

[Image: 20180601115440.png]

[Image: 20180601115007.png]

[Image: 20180601115029.png]

[Image: 20180601115042.png]

why the changes made in the list YEAR_1999_DAY_2 are not kept?
Find all posts by this user
Quote this message in a reply
06-01-2018, 08:54 PM
Post: #5
RE: how to remove string?
Code:
EXPORT LIST_1:={1,2,3}; 
EXPORT LIST_2:={"A","B","C"};

ID;
NUMBER;
VAR;

EXPORT global2()
BEGIN

NUMBER:=1;
ID:=EXPR("'LIST_"+NUMBER+"'");  // ID  =LIST_1
VAR:=EXPR("'LIST_"+NUMBER+"'"); // VAR =LIST_1

LIST_2▶VAR;

PRINT;
PRINT(ID+"=");
PRINT(VAR);

END;


another example
Why can not the global variables be modified from the program?
Find all posts by this user
Quote this message in a reply
06-01-2018, 09:27 PM
Post: #6
RE: how to remove string?
(06-01-2018 08:54 PM)Richard Wrote:  another example
Why can not the global variables be modified from the program?

Is this what you want to do :
Code:
EXPORT LIST_1:={1,2,3}; 
EXPORT LIST_2:={"A","B","C"};

ID;
NUMBER;
VAR;

EXPORT global2()
BEGIN

NUMBER:=1;
EXPR("ID:=LIST_"+NUMBER);      // ID  =LIST_1
EXPR("VAR:=LIST_"+(NUMBER+1)); // VAR =LIST_2

//LIST_2▶VAR;

PRINT;
PRINT(STRING(ID)+"=");
PRINT(VAR);

END;
Find all posts by this user
Quote this message in a reply
06-02-2018, 04:49 PM
Post: #7
RE: how to remove string?
Code:
EXPORT LIST_1:={1,2,3}; 

ID;
NUMBER;
VAR;

EXPORT CHANGE()
BEGIN

NUMBER:=1;
ID:=EXPR("'LIST_"+NUMBER+"'");  // ID  =LIST_1
VAR:=EXPR("'LIST_"+NUMBER+"'"); // VAR =LIST_1

EDITLIST(EVAL(ID)); // LIST_1:={ 1,2,3 } CHANGE LIST_1:{100,200,300}

// CHECK THIS GLOBAL VARIABLE IN MEM> USER VARIABLES> LIST_1
// You will see that the change is not saved
END;
Find all posts by this user
Quote this message in a reply
06-02-2018, 04:49 PM
Post: #8
RE: how to remove string?
Code:
EXPORT LIST_1:={1,2,3}; 

ID;
NUMBER;
VAR;

EXPORT CHANGE()
BEGIN

NUMBER:=1;
ID:=EXPR("'LIST_"+NUMBER+"'");  // ID  =LIST_1
VAR:=EXPR("'LIST_"+NUMBER+"'"); // VAR =LIST_1

EDITLIST(EVAL(ID)); // LIST_1:={ 1,2,3 } CHANGE LIST_1:{100,200,300}

// CHECK THIS GLOBAL VARIABLE IN MEM> USER VARIABLES> LIST_1
// You will see that the change is not saved
END;
Find all posts by this user
Quote this message in a reply
06-02-2018, 05:37 PM
Post: #9
RE: how to remove string?
(06-02-2018 04:49 PM)Richard Wrote:  
Code:
EXPORT LIST_1:={1,2,3}; 

ID;
NUMBER;
VAR;

EXPORT CHANGE()
BEGIN

NUMBER:=1;
ID:=EXPR("'LIST_"+NUMBER+"'");  // ID  =LIST_1
VAR:=EXPR("'LIST_"+NUMBER+"'"); // VAR =LIST_1

EDITLIST(EVAL(ID)); // LIST_1:={ 1,2,3 } CHANGE LIST_1:{100,200,300}

// CHECK THIS GLOBAL VARIABLE IN MEM> USER VARIABLES> LIST_1
// You will see that the change is not saved
END;

I don't know why your program ends up editing Ans instead of LIST_1, maybe Cyrille can provide some insights on how parameters are managed for EDITLIST.

However here is a way to edit the list defined by ID:
Code:
NUMBER:=1;
ID:="LIST_"+NUMBER;  // ID  ="LIST_1"

EXPR("EDITLIST("+ID+")"); // LIST_1:={ 1,2,3 } CHANGE LIST_1:{100,200,300}
Find all posts by this user
Quote this message in a reply
06-03-2018, 10:23 AM
Post: #10
RE: how to remove string?
Hello,

It also works if you put ID in single quotes, like this:

EDITLIST(EVAL('ID')); // LIST_1:={ 1,2,3 } CHANGE LIST_1:{100,200,300}

-road
Find all posts by this user
Quote this message in a reply
06-03-2018, 11:58 PM
Post: #11
RE: how to remove string?
Don't forget that EDITLIST returns the edited list - it doesn't automatically store it into the variable. SO you need to do MYVAR:=EDITLIST(...) to keep your changes...

TW

Although I work for the HP calculator group, the views and opinions I post here are my own.
Find all posts by this user
Quote this message in a reply
06-04-2018, 01:29 PM
Post: #12
RE: how to remove string?
Thank you so much guys

I had broken my head trying to solve this, the truth that I am a novice with this calculator

Thank you
Find all posts by this user
Quote this message in a reply
Post Reply 




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