truncate 

Truncates a long string to a specified length, optionally appending an ellipsis after the string.
Parameters
| Name | Type | Required | Default |
|---|---|---|---|
str | string | ● | – |
length | number | ● | – |
ellipsis![]() named | string | – | '' |

named parameters are passed as named parameters in Dart and keyword arguments in Python.
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...'python
truncate('hello', 3) # Returns 'hel'
truncate('hello', 2, '...') # Returns 'he...'