HP Forums
Can INPUT input what is typed - 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: Can INPUT input what is typed (/thread-4719.html)



Can INPUT input what is typed - StephenG1CMZ - 09-14-2015 05:28 PM

I have been trying to use INPUT to input search strings for my Z EDITOR program.

But the Prime seems to parse some inputs without passing them straight to the user program.

For example, if you type in a single bracket, INPUT shows a pair. This happens whether you enter a bracket by using the () key, then cursor right and delete left. Or by using Shift/Chars and then selecting a single bracket.

Is there a way to avoid this, so that I could search for "WAIT(" for example, rather than "WAIT()" BUT NOT "WAIT(1"?.

Code:

EXPORT TRYIN()
BEGIN
 LOCAL IN,TTL,LBL,HLP,RST,IVL;

 PRINT();
 IN:="";
 TTL:="TRYING INPUT";
 LBL:="INP";
 HLP:="HLP";
 RST:="";
 IVL:="";
 INPUT(IN,TTL,LBL,HLP,RST,IVL);
 PRINT(IN);

 PRINT(SIZE(IN));
 PRINT(DIM(IN));
 PRINT(ASC(IN));
 //PRINT(STRING(IN));
 //PRINT(QUOTE(EXPR(IN)));

 WAIT;
END;



RE: Can INPUT input what is typed - eried - 09-14-2015 05:46 PM

Have you tried to limit the input to Strings only?


RE: Can INPUT input what is typed - StephenG1CMZ - 09-14-2015 06:37 PM

(09-14-2015 05:46 PM)eried Wrote:  Have you tried to limit the input to Strings only?

I'd tried print(string(in... Gives a pair of brackets within an extra pair of quotes.

But if the user types the quotes himself:
"()" then deletes a )
The program sees:
""(""

At last there is a single bracket - now The problem is the extra pair of quotes.

Also, I don't really want the user to have to type in the quotes - switching between in and out of Alpha should be enough. And for simple searches like WAIT without any brackets, the quotes are not necessary.


RE: Can INPUT input what is typed - eried - 09-14-2015 06:45 PM

The help says that you could define String as the var type and the quotes will be hidden. It seems to be what you need but I don't know how that works. I just get error.


RE: Can INPUT input what is typed - StephenG1CMZ - 09-14-2015 08:34 PM

If I simply type in "WAIT" with quotes instead of just WAIT, into my existing program, the quotes are included in the match - and no match results. I'll think some more about the syntax.