I'm trying to use the LEFT(string,count) function in Cold Fusion to concatenate a longtext MySQL display on a page. However, I do not like the variable results because I set a specific character count versus it concatenating at a paragraph break or end of a sentence.
ie: If I have a longtext database field that is 500 characters long and includes paragraph breaks and I only have room on my page to display 75 characters (for design purposes) before I create a link to display the remainder of the text (e.g. <read more>), I want the break of the character to not be mid word or mid-sentence BUT also not to exceed the 75 characters. In other words, I want it to stop at the end of a sentence BEFORE 75 characters.
Because every record has variable characters, i can't simply do a specific character search other than a period with a space following it.
I need the best (least) code to have it analyze the database field results and stop the display per the above.
My current code is:
#Left(ParagraphFormat(description),75)#... <a href="link"><:read more></a>
which produces broken words with the ellipses following (which is okay)