HP Forums
a string question - 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: a string question (/thread-8995.html)



a string question - webmasterpdx - 09-06-2017 11:49 AM

I can get a program by doing this.
s:=Programs("TEST");
...returns the program TEST as a string stored in s.
s(i) indexes this string.
Now, what I want to know, is how do you index this program directly without using s.
e.g. I tried Programs("TEST")(i) and (Programs("TEST"))(i) and neither work, as the two braces are interpreted as a multiply.
I can do it in CAS mode but not in Home mode....
How would one do this in Home mode?
Thx
-Donald


RE: a string question - Stevetuc - 09-06-2017 01:43 PM

Best I could come up with:

ASC(MID(Programs("TEST"),i,1))
ASC returns a vector of length 1 from position i of the string

Eg {69} for the character "E"


RE: a string question - webmasterpdx - 09-06-2017 07:19 PM

That's what I was looking for....Thanks
-D