• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Lack of interest A word trim function

James

Well-known member
#1
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.
 

Mike

XenForo developer
Staff member
#2
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).
 

James

Well-known member
#3
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.