leftWords() function for trimming strings but keeping words intact
ColdFusionSomeone posted the following on our CFUG email list today looking for a way to trim a string to 250 characters, but if that 250 fell in the middle of a word, to exclude that last word and end the string at the preceding space. I created a simple little method for doing this named leftWord(), which accepts the two arguments "InputString" and "CharacterLimit". Feel free to better-fy it all you want! :)





Loading....