Closed A9G-Data-Droid closed 3 weeks ago
If i understand your question correctly, yes it is.
string example = "one,two.three;four";
char[] separators = { ',', '.', ';' };
string[] result = example.Split(separators);
// result = ["one", "two", "three", "four"]
@DaghanGuven That is what I am doing currently, that's what my link is to.
I'm asking if Sep
can do this. There is an interface on ReadOnlySpan<char>
called SplitAny that could be used.
However, the Sep Object only appears to store a single char
, with no overload for char[]
@A9G-Data-Droid thanks for trying out Sep and asking this question. Multiple separators is not supported no. Sep uses highly optimized code for parsing and having to support multiple separators would be a lot of work. Hence, I have no immediate plans to support this in Sep. If you only need basic parsing as supported by dotnet I would just use that. :)
Thanks @nietras ! Sep is great and it has become the tool I reach for whenever I am handling delimited data sets. In this case I will continue to use my own solution involving ReadOnlySpan<char>.SplitAny
@A9G-Data-Droid thanks 🤗
Is it possible to supply multiple separators, like Split) does?