Is there a something I can use in a bash script that will allow me to pipe in a string and have it output that string yet with a specified number of characters from the end of it removed?

EG:

Code:
z="The magic string"

echo $z
echo $z $(echo $z | ultra-cool-command 3)
output:
Code:
The magic string
The magic string The magic str