Trimming a block of text to the nearest word when a certain character limit is reached?

前端 未结 6 1099
甜味超标
甜味超标 2020-12-12 05:08

Here is the question: How would your trim a block of text to the nearest word when a certain amount of characters have past. I\'m not trying to limit a certain number words

6条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-12 05:56

    I wrote a max-string-length function that does just this and is very clean.

提交回复
热议问题