truncate JavaScriptDart
Truncates a long string to a specified length, optionally appending an ellipsis after the string.
Parameters
str::string
length::number
ellipsis::string || ''
Dart:Named
Returns
string
Examples
javascript
truncate('hello', 3); // Returns 'hel'
truncate('hello', 2, '...'); // Returns 'he...'
dart
truncate('hello', 3); // Returns 'hel'
truncate('hello', 2, ellipsis: '...'); // Returns 'he...'