Shorten string

Shorten string

Is there a way to shorten a string to a maximum number of characters. 

I have an html page where I don't want to show an entire text field, just the first 50 characters of each post, as some of the descriptions are very long. I would have though trim(50) would do this, but instead it just trims any spaces out, rather then actually "trimming" a string.