Skip to content

Commit

Permalink
Improve strutils.rsplit doc, proc and iterator have oppose result ord…
Browse files Browse the repository at this point in the history
…er. (#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.
```
  • Loading branch information
litlighilit committed May 10, 2024
1 parent 2995a03 commit 2e3777d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/pure/strutils.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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(':'):
Expand All @@ -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):
Expand Down Expand Up @@ -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"):
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 2e3777d

Please sign in to comment.