Hi.
Im my web app, I want to get the newer five books from the database and display them in the index page.
At the index page, the title of the book should be displayed and a
snippet of its description (lets say, the first 100 chars of its descripton).
Good example:
This book is written by .... <link>Read More</link>
Bad example :
This book is writ .... <link>Read More</link>
Do you see the problem ?
When I substring the description text, the whole last
word should be included in the snippet not part of it.
Here is my small algorithm :
- use substring(0, 150)
- if the last character is a white space, then substring (0, 151)
- repeat
Do you suggest a better solution ? :roll: