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 or letters, but limit the letters and cut it off at the nearest word.
Say I had two strings:
"This is a block of text, blah blah blah"
"this is another block of txt 2 work with"
Say I wanted to limit it to 27 characters, the first line would end at "blah" and the second on would end at "txt" even though the character limits are reached within those words.
Is there any clean solution to this problem?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…