a library to speed up the development of Fivem scripts and frameworks
fivem-ts - Documentation v0.7.5 • Docs
fivem-ts - Documentation v0.7.5 / Shared / truncateString
truncateString(
input
,maxLength
,useEllipsis
):string
Truncates a string to a specified length and optionally appends an ellipsis.
• input: string
The input string to be truncated.
• maxLength: number
The maximum length of the resulting string.
• useEllipsis: boolean
= false
Whether to append an ellipsis (...
) if the string is truncated. Defaults to false
.
string
The truncated string.
const result = truncateString("This is a long string", 10, true);
console.log(result); // "This is a..."