HP Forums

Full Version: Head and Tail functions
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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
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")));
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
Reference URL's