For example if I have the following text:
"a b c d e" which is 9 characters long and I was to apply a wholeWordTrim of 8 characters, the result would be "a b c d..." assuming I accept the defaults, which is 10 characters long. Ideally I should be getting "a b c..." which is 8 characters long. I could allow for those elipses and apply a limit of 5 characters so that it would return "a b c d...", but then I would be unnecessarily trimming the text if my original string request was 7 or 8 characters long. This has been an issue for me in addon development where strict string limits are being applied such as in thread title or twitter submissions.
Ideally the function should measure the length of the string submitted and the appended bit. then apply the following rules
if string length is <= length limit, return the string
else trim to (length limit - length of appendage), add appendage and return.