HP Forums
Head and Tail 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: Head and Tail functions (/thread-4915.html)



Head and Tail functions - eried - 10-10-2015 10:52 PM

How to use head and tail with strings inside a program?

It seems quite inconsistent:
Code:
HOME:
tail("hola"); // return empty matrix
head("hola"); // return the same string

Syntax error if used uppercades (with msgbox)

Code:
CAS:
tail("hola"); // correct
head("hola"); // correct

Weird error if used uppercased (no msgbox) but return:
of(["Error: Bad Argument Value"])

Inside a program it seems to work like as in HOME, with or without CAS. in front


RE: Head and Tail functions - komame - 10-11-2015 06:03 AM

It seems to be a small bug here.
I hope it will be fixed soon, but now we can use a workaround for strings:
Code:
CHAR(head(ASC("hola")));
CHAR(tail(ASC("hola")));



RE: Head and Tail functions - cyrille de brébisson - 10-12-2015 06:43 AM

hello,

head and tail are CAS functions, so use of them for home/PPL stuff is "discouraged".

Assuming str contains your string, in home/PPL, str(1,1) will do a head and str(2,100000) a tail.

Cyrille