HP 50g Compare Strings?
09-01-2014, 12:03 PM
Post: #1
 toml_12953 Senior Member Posts: 1,864 Joined: Dec 2013
HP 50g Compare Strings?
How do you compare the contents of a variable to a string in algebraic notation on an HP 50g? I've tried both the following ('a' contains either "Y" or "N")

Code:
 IF ' 'a' == "Y" ' THEN IF 'a == "Y" ' THEN

Of course neither one works. So how do you do it?

TIA

Tom L

Tom L
Cui bono?
09-01-2014, 12:09 PM
Post: #2
 Joe Horn Senior Member Posts: 1,841 Joined: Dec 2013
RE: HP 50g Compare Strings?
(09-01-2014 12:03 PM)toml_12953 Wrote:  How do you compare the contents of a variable to a string in algebraic notation on an HP 50g? I've tried both the following ('a' contains either "Y" or "N")

Code:
 IF ' 'a' == "Y" ' THEN IF 'a == "Y" ' THEN

Of course neither one works. So how do you do it?

Suggestion: Don't use an algebraic. Just use IF a "Y" SAME THEN.

<0|ɸ|0>
-Joe-
09-01-2014, 01:25 PM
Post: #3
 toml_12953 Senior Member Posts: 1,864 Joined: Dec 2013
RE: HP 50g Compare Strings?
(09-01-2014 12:09 PM)Joe Horn Wrote:
(09-01-2014 12:03 PM)toml_12953 Wrote:  How do you compare the contents of a variable to a string in algebraic notation on an HP 50g? I've tried both the following ('a' contains either "Y" or "N")

Code:
 IF ' 'a' == "Y" ' THEN IF 'a == "Y" ' THEN

Of course neither one works. So how do you do it?

Suggestion: Don't use an algebraic. Just use IF a "Y" SAME THEN.
That works, thanks! You should be canonized, but I can't find my cannon at the moment. ;^)

Tom L
Cui bono?
09-01-2014, 10:24 PM
Post: #4
 Joe Horn Senior Member Posts: 1,841 Joined: Dec 2013
RE: HP 50g Compare Strings?
(09-01-2014 01:25 PM)toml_12953 Wrote:  That works, thanks! You should be canonized, but I can't find my cannon at the moment. ;^)

No need; I'm already a canon regular.

<0|ɸ|0>
-Joe-
09-02-2014, 03:07 AM
Post: #5
 rprosperi Super Moderator Posts: 5,254 Joined: Dec 2013
RE: HP 50g Compare Strings?
(09-01-2014 10:24 PM)Joe Horn Wrote:
(09-01-2014 01:25 PM)toml_12953 Wrote:  That works, thanks! You should be canonized, but I can't find my cannon at the moment. ;^)

No need; I'm already a canon regular.

An absolutely perfect setup like that does not come along every day

--Bob Prosperi
09-04-2014, 06:35 AM (This post was last modified: 09-04-2014 07:39 AM by toml_12953.)
Post: #6
 toml_12953 Senior Member Posts: 1,864 Joined: Dec 2013
RE: HP 50g Compare Strings?
(09-01-2014 10:24 PM)Joe Horn Wrote:
(09-01-2014 01:25 PM)toml_12953 Wrote:  That works, thanks! You should be canonized, but I can't find my cannon at the moment. ;^)

No need; I'm already a canon regular.

You win! BTW, I figured out how to do what I originally wanted to do. To test for a string in algebraic notation, enclose the test in reverse quotes (the character just before the lowercase a in the CHAR screen.)

This works:

Code:
IF a=="N" THEN

Tom L
Cui bono?
 « Next Oldest | Next Newest »

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