I'm wondering if it's possible to set a character (characters as in letters, no html elements or tags included) limit on a XhtmlString, and if yes, how can I do that? I found this thread from 2008, https://world.episerver.com/forum/developer-forum/Developer-to-developer/Thread-Container/2008/3/Char-limit-on-XHTML-string/ which suggests using a custom built function.
Unfortunately that is not possible to do out of the box, and really hard to get right, I think.
Some time ago I did however create a validation that displayed a warning to the editor when the text was possibly too long. I stripped out the html and counted the characters.
You can read more here: