HP Forums
String Functions - 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: String Functions (/thread-2551.html)



String Functions - Snorre - 12-04-2014 12:23 AM

Hello,

First: many thanks to the HP team for the update (I love it beeing finally able to enter commented or even incomplete CAS programs).

I know, the Prime is not intended for string processing.
But it would be really nice if the string functions LEFT, MID and RIGHT would be fixed eventually (it doesn't seem like a big deal).
I'd prefer LEFT("hello",0) or RIGHT("hello",0) or MID("hello",6,1) to return an empty string. Especially MID("hello",3,-1) should behave more friendly.

Greetings.


RE: String Functions - Han - 12-04-2014 01:25 AM

(12-04-2014 12:23 AM)Snorre Wrote:  Hello,

First: many thanks to the HP team for the update (I love it beeing finally able to enter commented or even incomplete CAS programs).

I know, the Prime is not intended for string processing.
But it would be really nice if the string functions LEFT, MID and RIGHT would be fixed eventually (it doesn't seem like a big deal).
I'd prefer LEFT("hello",0) or RIGHT("hello",0) or MID("hello",6,1) to return an empty string. Especially MID("hello",3,-1) should behave more friendly.

Greetings.

I agree on all accounts. In general, the string operations should return a null string if the arguments do not result in a proper substring. The MID("hello",3,-1) bug is really bad, though. On my calculator, it resulted in a crash that required a reset via the pinhole in the back.