Skip to main content
Known Participant
December 3, 2008
Answered

Split string after full word

  • December 3, 2008
  • 4 replies
  • 1082 views
Hi everyone,

I have some dynamic text which is shown completely if it has less then 280 characters.When it has more then 280 characters I display the first 280 and after that I just set 3 dots"...". Now my question was if it is possible to display the 3 dots after the last full word after those 280 characters.

Example Now: "this is just an examp..." (cuts of the word)
Example how it should be: "this is just an example." (shows the whole word an cuts of afterwards)

Thanks in advance!
This topic has been closed for replies.
Correct answer Newsgroup_User
if that one won't do it, try this one:
http://www.cflib.org/udf/abbreviate

"Abbreviates a given string to roughly the given length, stripping any
tags, making sure the ending doesn't chop a word in two, and adding an
ellipsis character at the end."


Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/

4 replies

tclaremont
Inspiring
December 4, 2008
Retrieve all 280 characters, and then use the string functions to search backwards and remove all characters AFTER the LAST space in the 280 character string.

The online documentation will tell you all you need to know about string manipulation functions.
Newsgroup_UserCorrect answer
Inspiring
December 4, 2008
if that one won't do it, try this one:
http://www.cflib.org/udf/abbreviate

"Abbreviates a given string to roughly the given length, stripping any
tags, making sure the ending doesn't chop a word in two, and adding an
ellipsis character at the end."


Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
WouterDBAuthor
Known Participant
December 5, 2008
Thanks, this works like a charm :)

Kind regards,

Wouter
Inspiring
December 3, 2008
I think this one will do,

http://cflib.org/udf/GetWords
Inspiring
December 3, 2008
Hi WoulterDB,

Try this "MaxLength" UDF!.

http://cflib.org/udf/MaxLength
WouterDBAuthor
Known Participant
December 3, 2008
Thanks for the reply but this function gives me the same output as I had before. It limits the string that's good, but if it has reached the limit it cuts of the word and puts "..." after it. I'm searching for a way to not cut up the final word into pieces, so the last word should be completely visible and after that there should be 3 dots "...", not in the middle of a word.