Home > @microsoft/node-core-library > Text > truncateWithEllipsis

Text.truncateWithEllipsis() method

If the string is longer than maximumLength characters, truncate it to that length using “…” to indicate the truncation.

Signature:

static truncateWithEllipsis(s: string, maximumLength: number): string;

Parameters

Parameter Type Description
s string  
maximumLength number  

Returns:

string

Remarks

For example truncateWithEllipsis(‘1234578’, 5) would produce ‘12…’.