I have a repeater connected to dataset. I use it for displaying news on home page. I wanted introductory text to be displayed in fixed size, so I used code for number of characters to display.
I would like that words are not cut, but to show the entire word and after that “…”, so my question is: is there code that I can use to define number of words to show insted number of characters.
What is the difference between WORDS and CHARACTERS?
exactly–> a word consists of several characters and is diveded by spaces.
You can for example use REG-EX to count matched words of a defined search-pattern (for example → it is a word —> when it consists of more than one character, or it is a word, when two character-blocks are devided by a space).
Or you do it the simple way → just counting the spaces between the words and characters.
My two-cents: I think dividing by words is a bad idea, because if the sentence has mainly short words it will look strange, and if it has mainly long words then it will overflow, defeating the purpose of limiting the text. Cutting off the characters might be a bit ugly, but I think it is the least ugly option.