Add strip() example (#8002)
This commit is contained in:
parent
8960efa340
commit
b62328cb76
1 changed files with 2 additions and 0 deletions
|
|
@ -336,6 +336,8 @@ proc strip*(s: string, leading = true, trailing = true,
|
|||
## 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.
|
||||
runnableExamples:
|
||||
doAssert " vhellov ".strip().strip(trailing = false, chars = {'v'}) == "hellov"
|
||||
var
|
||||
first = 0
|
||||
last = len(s)-1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue