[API Proposal]: System.String.RSplit #109583
Labels
api-suggestion
Early API idea and discussion, it is NOT ready for implementation
area-System.Runtime
untriaged
New issue has not been triaged by the area owner
Background and motivation
Python exposes this as rsplit (tests showing behavior here).
Note that Python's
maxsplit
parameter has a bit different semantics than C#'sSplit
'scount
. C#'sRSplit
should use C#'sSplit
'scount
semantics.API Proposal
This should behave exactly like the System.String.Split overloads that accept
count
, except we start counting delimiters from the right instead of the left.API Usage
"ABC-DEF-GHI".RSplit('-', count: 2)
returns["ABC-DEF", "GHI"]
Alternative Designs
Instead of adding a new
RSplit
method, I could see this also being implemented as a newStringSplitOptions
.Risks
No response
The text was updated successfully, but these errors were encountered: