You are using an outdated & insecure version of Internet Explorer. Certain features of this website will not function correctly. Please consider upgrading.
wp_trim_words()which does as you might expect: trim’s a specified string to a set number of words.
It’s also worth noting that this function is localized, meaning that for East Asian languages where a single character is actually a word, the function will still work as expected.
There’s actually a plethora of built-in utility functions like this built into WordPress which can be explored in