Methods
limit
ΒΆ
limit(s:
Str
, n:
Int
, marker:
Str
=)
Truncate a string if necessary so it would have maximum n characters (currently bytes).
Source:
stdlib.ngs:2501
s
The string to (possibly) truncate.
n
Maximum characters
marker
The truncation marker
Returns
Either s or new Str of length n
Example
"abc".limit(5, "...") # "abc" "abcdef".limit(5, "...") # "ab..." "abcdef".limit(2) # "ab"