I am looking for a good way to add the ellipsis "..." when I need to gracefully display an oversized line and not fit into the space I want.
What I'm doing now is finding the maximum length of characters that will fit into the space, and then cut the string to this length and add "...". All this is server side.
In pseudocode should look like this:
// I define this MAXCHARS var value by hunch
String outputString = MyLengthyString.SubString(0, MAXCHARS)
outputString.concatenate("...")
view.aLabelInThePage = outputString
The problem is that when I do not use fixed-length fonts, it may not display the way I want (taking up all the space).
Is there a way to get the desired results using just JavaScript and CSS? If not, is there a better way than mine?