Avatar ·

How to split a string by another string (not a character) in C#?

Hi everyone! I'm a beginner in C# and encountered a problem when working with strings. I need to split a string into an array of substrings using not a single character but an entire string as a delimiter. For example, I have a string: ```csharp string data = "Hello||world||C#"; ``` I want to get an array: `["Hello", "world", "C#"]` using the delimiter `"||"`. The problem is that the standard `string.Split()` method only accepts single characters or an array of characters. I tried writing this: ```csharp string[] parts = data.Split("||"); ``` But the compiler gives an error that it cannot convert a string to char. I also tried using the overload with `StringSplitOptions`, but it still doesn't work. I know that this can be done manually using a loop, but that's ugly and probably there is a