5 lines
147 B
Python
5 lines
147 B
Python
|
def cut_str(string, length, ellipsis='...'):
|
||
|
if len(string) < length:
|
||
|
return string
|
||
|
return string[0:length-len(ellipsis)]+ellipsis
|