mirror of
https://github.com/nim-lang/Nim.git
synced 2026-06-06 20:04:18 +00:00
Add strip() example (#8002)
This commit is contained in:
committed by
Andreas Rumpf
parent
8960efa340
commit
b62328cb76
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user