changeset 445 | 98b00191ce4f |
parent 419 | 05ff71a02b2d |
child 451 | c54f05d00f63 |
--- a/src/pyams_utils/text.py Fri Nov 13 12:51:19 2020 +0100 +++ b/src/pyams_utils/text.py Fri Nov 13 12:52:53 2020 +0100 @@ -53,9 +53,11 @@ 'This is a long…' >>> get_text_start('This is a long string', 20, 7) 'This is a long string' + >>> get_text_start('This is a long string', -1) + 'This is a long string' """ result = text or '' - if length > len(result): + if (length < 0) or (length > len(result)): return result index = length - 1 text_length = len(result)