Lack of interest A word trim function


Well-known member
I'd like a word trim function that trims full words. For example:
I have a $sentence: "My name is James and I like XenForo"

At first, I thought {xen:helper wordtrim, $sentence, 3} would return "My name is", but it actually just returned "My...", so here I am suggesting a function to trim actual words from a sentence to a specific word count - not character count.


XenForo developer
Staff member
Any particular reason you want words rather than characters? It's mostly done with characters for space reasons. The amount of space X words can use is highly variable (more so than general character use in Western languages).


Well-known member
Character-based limits are good for the space reasons (obviously), I just find word limits to seem logical. You might want to show the first X words of (for example) an article, rather than the first X characters.

Where space is precious (i.e. thread previews) I agree to the character limits, but I'm sure some add-ons would make use of a word-based trim function.