HP Forums
Using QUOTE() in a String? - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: Using QUOTE() in a String? (/thread-17036.html)



Using QUOTE() in a String? - matalog - 06-01-2021 10:26 AM

Is there anyway to get the output of a QUOTE() usable as a string?

I tried

Input(H,"EQ: ");
String(QUOTE(H))(store arrow)Notes("quotenote");

But it results in an input error.

I want to get the expression, unchanged and unevaluated into a string so I can copy it to a note object. That is, the expression that I type in, be it 3*4/5 or SIN(45)*31.


RE: Using QUOTE() in a String? - Stevetuc - 06-01-2021 12:00 PM

(06-01-2021 10:26 AM)matalog Wrote:  Is there anyway to get the output of a QUOTE() usable as a string?

I tried

Input(H,"EQ: ");
String(QUOTE(H))(store arrow)Notes("quotenote");

But it results in an input error.

I want to get the expression, unchanged and unevaluated into a string so I can copy it to a note object. That is, the expression that I type in, be it 3*4/5 or SIN(45)*31.

I'm not sure QUOTE is the right command to use here and the Var H is typed as Real.
The following will input h as a string then save contents of h into a note.The type [2] forces h to be treated as a string.
Code:

EXPORT QQ()
BEGIN
LOCAL h;
Input({{h,[2]}},"EQ: ");
h▶Notes("quotenote");
END;



RE: Using QUOTE() in a String? - matalog - 06-01-2021 12:47 PM

(06-01-2021 12:00 PM)Stevetuc Wrote:  
(06-01-2021 10:26 AM)matalog Wrote:  Is there anyway to get the output of a QUOTE() usable as a string?

I tried

Input(H,"EQ: ");
String(QUOTE(H))(store arrow)Notes("quotenote");

But it results in an input error.

I want to get the expression, unchanged and unevaluated into a string so I can copy it to a note object. That is, the expression that I type in, be it 3*4/5 or SIN(45)*31.

I'm not sure QUOTE is the right command to use here and the Var H is typed as Real.
The following will input h as a string then save contents of h into a note.The type [2] forces h to be treated as a string.
Code:

EXPORT QQ()
BEGIN
LOCAL h;
Input({{h,[2]}},"EQ: ");
h▶Notes("quotenote");
END;


Thanks, yes that works to get the string out.

I was also planning to to have the Quote() because I planned to also EVAL() it afterwards, and therfore find the answer to the expression, while also having the expression that has been answered.

Can you think of a way of having both of those? Or to turn a string into an evaluatable thing?


RE: Using QUOTE() in a String? - Stevetuc - 06-01-2021 04:04 PM

(06-01-2021 12:47 PM)matalog Wrote:  
(06-01-2021 12:00 PM)Stevetuc Wrote:  I'm not sure QUOTE is the right command to use here and the Var H is typed as Real.
The following will input h as a string then save contents of h into a note.The type [2] forces h to be treated as a string.
Code:

EXPORT QQ()
BEGIN
LOCAL h;
Input({{h,[2]}},"EQ: ");
h▶Notes("quotenote");
END;


Thanks, yes that works to get the string out.

I was also planning to to have the Quote() because I planned to also EVAL() it afterwards, and therfore find the answer to the expression, while also having the expression that has been answered.

Can you think of a way of having both of those? Or to turn a string into an evaluatable thing?

Try adding the line EXPR(h) before the END statement