1

How to truncate a string after n number of words?

Share:

The result of the snippet:

Filed in: Regular Expressions

One Response to "How to truncate a string after n number of words?"

  1. I have approached this same problem in a slightly different manner.
    I have used java.text.BreakIterator.
    If anyone wants to view my solution to this same problem
    they can view it here:
    http://www.mohanarun.com/java-code-of-the-week-how-to-return-certain-number-of-words-from-a-string/

Leave a Reply

Submit Comment

© 2014 Java Examples - Developed with