I am building a news section for a site in which the headlines could be quite long and this will probably upset my formatting and make the page look crap.

Is there a way to take a string and spit out say the first 40 characters only?