Remove spaces when echoing the_title

Ever wanted to print or echo the WordPress title attribute without spaces?

Limit the characters that display on the_title

Limit the characters that display on the_title

Ever wanted to display the title of a post somewhere but limit the amount of characters that are shown? For instance, this post has a very long title, and if I were to use…