Using QUOTE() in a String?
06-01-2021, 10:26 AM
Post: #1
 matalog Member Posts: 211 Joined: May 2021
Using QUOTE() in a String?
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.
06-01-2021, 12:00 PM
Post: #2
 Stevetuc Senior Member Posts: 303 Joined: Jan 2014
RE: Using QUOTE() in a String?
(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;
06-01-2021, 12:47 PM (This post was last modified: 06-01-2021 03:36 PM by matalog.)
Post: #3
 matalog Member Posts: 211 Joined: May 2021
RE: Using QUOTE() in a String?
(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?
06-01-2021, 04:04 PM
Post: #4
 Stevetuc Senior Member Posts: 303 Joined: Jan 2014
RE: Using QUOTE() in a String?
(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
 « Next Oldest | Next Newest »

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