I'm looking for a good way to append "..." when I need to gracefully display a string that is too large and doesn't fit in the space that I want.
The way that I'm currently doing that is looking for a max length of characters that will fit in the space, then cut the string to that length and append the "..." . All that in the server-side.
In pseudocode should look like:
// I define this MAXCHARS var value by hunch
String outputString = MyLengthyString.SubString(0, MAXCHARS)
outputString.concatenate("...")
view.aLabelInThePage = outputString
The problem is when I'm not using fixed-length fonts, it could be displayed not in the way that I want (occupying all the space).
Is there any way to get the desired results only using javascript and CSS? If not, is there a better way than mine's?