Limit string length or amount of words of content field

Hi, I was wondering is there’s a way to limit the amount of words from the content result attribute from the API side?