1. 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

Discussion in 'Closed Suggestions' started by James, Oct 11, 2011.

  1. James

    James 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.
  2. Mike

    Mike 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).
  3. James

    James 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.

Share This Page