Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Split string after full word

New Here ,
Dec 03, 2008 Dec 03, 2008
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!
TOPICS
Advanced techniques
959
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Dec 03, 2008 Dec 03, 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/
Translate
Advocate ,
Dec 03, 2008 Dec 03, 2008
Hi WoulterDB,

Try this "MaxLength" UDF!.

http://cflib.org/udf/MaxLength
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 03, 2008 Dec 03, 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.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Dec 03, 2008 Dec 03, 2008
I think this one will do,

http://cflib.org/udf/GetWords
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 03, 2008 Dec 03, 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/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 05, 2008 Dec 05, 2008
LATEST
Thanks, this works like a charm :)

Kind regards,

Wouter
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Dec 04, 2008 Dec 04, 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.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources