-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1c518db
commit 236014c
Showing
4 changed files
with
85 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
using System.Buffers; | ||
|
||
namespace Split.Extensions; | ||
|
||
public static class SpanExtensions | ||
{ | ||
public static SplitEnumerator<char> SplitOn(this string source, char separator) => | ||
Span.Split(source, separator); | ||
|
||
public static SplitEnumerator<char> SplitOn(this string source, string separator) => | ||
Span.Split(source, separator); | ||
|
||
public static SplitEnumerator<char> SplitOn(this ReadOnlySpan<char> source, char separator) => | ||
Span.Split(source, separator); | ||
|
||
public static SplitEnumerator<char> SplitOn(this ReadOnlySpan<char> source, ReadOnlySpan<char> separator) => | ||
Span.Split(source, separator); | ||
|
||
public static SplitEnumerator<char> SplitOnAny(this string source, ReadOnlySpan<char> separators) => | ||
Span.SplitAny(source, separators); | ||
|
||
public static SplitEnumerator<char> SplitOnAny(this ReadOnlySpan<char> source, ReadOnlySpan<char> separators) => | ||
Span.SplitAny(source, separators); | ||
|
||
public static SplitEnumerator<char> SplitOnAny(this ReadOnlySpan<char> source, string separators) => | ||
Span.SplitAny(source, separators); | ||
|
||
public static SplitEnumerator<char> SplitOnAny(this ReadOnlySpan<char> source, SearchValues<char> separators) => | ||
Span.SplitAny(source, separators); | ||
|
||
|
||
public static SplitEnumerator<byte> SplitOn(this byte[] source, byte separator) => | ||
Span.Split(source, separator); | ||
|
||
public static SplitEnumerator<byte> SplitOn(this ReadOnlySpan<byte> source, byte separator) => | ||
Span.Split(source, separator); | ||
|
||
public static SplitEnumerator<byte> SplitOn(this ReadOnlySpan<byte> source, ReadOnlySpan<byte> separator) => | ||
Span.Split(source, separator); | ||
|
||
|
||
public static SplitEnumerator<byte> SplitOnAny(this byte[] source, ReadOnlySpan<byte> separators) => | ||
Span.SplitAny(source, separators); | ||
|
||
public static SplitEnumerator<byte> SplitOnAny(this ReadOnlySpan<byte> source, ReadOnlySpan<byte> separators) => | ||
Span.SplitAny(source, separators); | ||
|
||
public static SplitEnumerator<byte> SplitOnAny(this ReadOnlySpan<byte> source, SearchValues<byte> separators) => | ||
Span.SplitAny(source, separators); | ||
|
||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using System.Buffers; | ||
|
||
namespace Split; | ||
|
||
public static class Span | ||
{ | ||
public static SplitEnumerator<char> Split(ReadOnlySpan<char> source, char separator) => | ||
new SplitEnumerator<char>(source, separator); | ||
|
||
public static SplitEnumerator<char> Split(ReadOnlySpan<char> source, ReadOnlySpan<char> separator) => | ||
new SplitEnumerator<char>(source, separator, true); | ||
|
||
public static SplitEnumerator<char> SplitAny(ReadOnlySpan<char> source, ReadOnlySpan<char> separators) => | ||
new SplitEnumerator<char>(source, separators); | ||
|
||
public static SplitEnumerator<char> SplitAny(ReadOnlySpan<char> source, SearchValues<char> separators) => | ||
new SplitEnumerator<char>(source, separators); | ||
|
||
public static SplitEnumerator<byte> Split(ReadOnlySpan<byte> source, byte separator) => | ||
new SplitEnumerator<byte>(source, separator); | ||
|
||
public static SplitEnumerator<byte> Split(ReadOnlySpan<byte> source, ReadOnlySpan<byte> separator) => | ||
new SplitEnumerator<byte>(source, separator, true); | ||
|
||
public static SplitEnumerator<byte> SplitAny(ReadOnlySpan<byte> source, ReadOnlySpan<byte> separators) => | ||
new SplitEnumerator<byte>(source, separators); | ||
|
||
public static SplitEnumerator<byte> SplitAny(ReadOnlySpan<byte> source, SearchValues<byte> separators) => | ||
new SplitEnumerator<byte>(source, separators); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters