C# – How to split a string and store in different string array

c

if i have a string like

string hello="HelloworldHellofriendsHelloPeople";

i would like to store this in a string like this

Helloworld
Hellofriends
HelloPeople

It has to change the line when it finds the string "hello"

thanks

Best Answer

string hello = "HelloworldHellofriendsHelloPeople";
var a = hello.Split(new string[] { "Hello"}, StringSplitOptions.RemoveEmptyEntries);
foreach (string s in a)
    Console.WriteLine("Hello" + s);