HEAD and TAIL functions on strings