diff options
author | flywind <43030857+xflywind@users.noreply.github.com> | 2020-12-23 04:57:48 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-23 11:57:48 +0100 |
commit | 417c2509c42367edc4130a8761fae80d529d8574 (patch) | |
tree | 7c2a0c7b62960574749f901e35d2177d5b8747da /lib | |
parent | 8d913a5921d7245ad80e92a040b5bc8ba6f97f44 (diff) | |
download | Nim-417c2509c42367edc4130a8761fae80d529d8574.tar.gz |
strip minor improvement (#16444)
* strip minor improvement * add more tests * Update tests/stdlib/tstrutils.nim Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pure/strutils.nim | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/pure/strutils.nim b/lib/pure/strutils.nim index 04ba71315..0028ac4fb 100644 --- a/lib/pure/strutils.nim +++ b/lib/pure/strutils.nim @@ -2813,7 +2813,7 @@ func strip*(s: string, leading = true, trailing = true, if leading: while first <= last and s[first] in chars: inc(first) if trailing: - while last >= 0 and s[last] in chars: dec(last) + while last >= first and s[last] in chars: dec(last) result = substr(s, first, last) func stripLineEnd*(s: var string) = |