diff options
author | lit <litlighilit@foxmail.com> | 2024-05-10 16:30:06 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-10 10:30:06 +0200 |
commit | 2e3777d6f39fd3593a69a498a5524db2006fdc91 (patch) | |
tree | 91e3e6869ceae59afa734321d32faf76aae360d5 /lib | |
parent | 2995a0318be391097f17cb764556294dca5695e8 (diff) | |
download | Nim-2e3777d6f39fd3593a69a498a5524db2006fdc91.tar.gz |
Improve strutils.rsplit doc, proc and iterator have oppose result order. (#23570)
[`rsplit iterator`](https://nim-lang.org/docs/strutils.html#rsplit.i,string,char,int) yields substring in reversed order, while [`proc rsplit`](https://nim-lang.org/docs/strutils.html#rsplit%2Cstring%2Cchar%2Cint)'s order is not reversed, but its doc only declare ``` The same as the rsplit iterator, but is a func that returns a sequence of substrings. ```
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pure/strutils.nim | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/pure/strutils.nim b/lib/pure/strutils.nim index 741562a6e..db107e3a5 100644 --- a/lib/pure/strutils.nim +++ b/lib/pure/strutils.nim @@ -565,7 +565,7 @@ iterator rsplit*(s: string, sep: char, maxsplit: int = -1): string = ## Splits the string `s` into substrings from the right using a ## string separator. Works exactly the same as `split iterator - ## <#split.i,string,char,int>`_ except in reverse order. + ## <#split.i,string,char,int>`_ except in **reverse** order. ## ## ```nim ## for piece in "foo:bar".rsplit(':'): @@ -592,7 +592,7 @@ iterator rsplit*(s: string, seps: set[char] = Whitespace, maxsplit: int = -1): string = ## Splits the string `s` into substrings from the right using a ## string separator. Works exactly the same as `split iterator - ## <#split.i,string,char,int>`_ except in reverse order. + ## <#split.i,string,char,int>`_ except in **reverse** order. ## ## ```nim ## for piece in "foo bar".rsplit(WhiteSpace): @@ -622,7 +622,7 @@ iterator rsplit*(s: string, sep: string, maxsplit: int = -1, keepSeparators: bool = false): string = ## Splits the string `s` into substrings from the right using a ## string separator. Works exactly the same as `split iterator - ## <#split.i,string,string,int>`_ except in reverse order. + ## <#split.i,string,string,int>`_ except in **reverse** order. ## ## ```nim ## for piece in "foothebar".rsplit("the"): @@ -805,7 +805,7 @@ func split*(s: string, sep: string, maxsplit: int = -1): seq[string] {.rtl, func rsplit*(s: string, sep: char, maxsplit: int = -1): seq[string] {.rtl, extern: "nsuRSplitChar".} = ## The same as the `rsplit iterator <#rsplit.i,string,char,int>`_, but is a func - ## that returns a sequence of substrings. + ## that returns a sequence of substrings in original order. ## ## A possible common use case for `rsplit` is path manipulation, ## particularly on systems that don't use a common delimiter. @@ -835,7 +835,7 @@ func rsplit*(s: string, seps: set[char] = Whitespace, maxsplit: int = -1): seq[string] {.rtl, extern: "nsuRSplitCharSet".} = ## The same as the `rsplit iterator <#rsplit.i,string,set[char],int>`_, but is a - ## func that returns a sequence of substrings. + ## func that returns a sequence of substrings in original order. ## ## A possible common use case for `rsplit` is path manipulation, ## particularly on systems that don't use a common delimiter. @@ -867,7 +867,7 @@ func rsplit*(s: string, seps: set[char] = Whitespace, func rsplit*(s: string, sep: string, maxsplit: int = -1): seq[string] {.rtl, extern: "nsuRSplitString".} = ## The same as the `rsplit iterator <#rsplit.i,string,string,int,bool>`_, but is a func - ## that returns a sequence of substrings. + ## that returns a sequence of substrings in original order. ## ## A possible common use case for `rsplit` is path manipulation, ## particularly on systems that don't use a common delimiter. |