I have a model and source sequence. It is required to cut all occurrences of the model sequence in the original. The output is a sequence of sequences. The following are examples:
splitOn "x" "axbxc" = ["a","b","c"] splitOn "x" "axbxcx" = ["a","b","c",""] In other words, you need to implement an analogue of the Haskell function splitOn in C #.
Accordingly, I want to find an elegant solution to this problem. You can use the native approach with quadratic complexity, but I can not beautifully implement it in C # (I would like a more functional solution). Maybe there is a built-in function? Google on this issue is silent
PS The sequence may contain not only characters, but also other objects (for which the equal / not equal operation is defined)
string.Split('x')? - ixSci