@mocanvas/mocanvas · function

truncateStringWithEllipsis

declare function truncateStringWithEllipsis(value: string, max: number): string

Shorten a string with an ellipsis, on a grapheme boundary.

Cutting on a code unit splits surrogate pairs and combining marks, which turns a page name into a replacement character.

mocanvas is built by Symbio. Free for non-commercial, non-profit and development use; commercial use needs an agreement. Not affiliated with or endorsed by tldraw.