strutils.strip: improve the documentation; fixes #7159

This commit is contained in:
Andreas Rumpf
2018-03-05 21:45:13 +01:00
parent e2094bc6f4
commit 0132442c1d

View File

@@ -440,10 +440,12 @@ proc cmpIgnoreStyle*(a, b: string): int {.noSideEffect,
proc strip*(s: string, leading = true, trailing = true,
chars: set[char] = Whitespace): string
{.noSideEffect, rtl, extern: "nsuStrip".} =
## Strips `chars` from `s` and returns the resulting string.
## Strips leading or trailing `chars` from `s` and returns
## the resulting string.
##
## If `leading` is true, leading `chars` are stripped.
## If `trailing` is true, trailing `chars` are stripped.
## If both are false, the string is returned unchanged.
var
first = 0
last = len(s)-1