-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Closed
Milestone
Description
Not sure if it is there already, but Split will be a great addition to Span/Memory, especially those related to char or byte.
Currently, String.Split creates multiple copies of sub-strings in an array. I can remember many times that I ended up rolling my own Split with IndexOf just to avoid creating large number of one-time strings in tight loops.
Adding Split to Span and Memory can alleviate all this, especially in common situations where:
- A
stringis split into multiple lines via\n - Each line is split into multiple fields via white-space to extract a command and parameters
- Each command is processed individually
Both dotnet/corefx#1 and dotnet/corefx#2 above can be replaced by Span.Split which creates a simple array of a value type.
A further enhancement is to have Span.Split return a Span<Span<char>> to avoid creating the array.
Metadata
Metadata
Assignees
Labels
No labels