How to split a string on array of characters in C#

1 Answer

0 votes
using System;

class Program
{
    static void Main() {
        string str = "CullenAurthurCoreEcho";
        
        char[] array = { 'A', 'r' }; 
        
        string[] words = str.Split(array);
        
        foreach (string word in words) {
            Console.WriteLine(word);
        }
    }
}




/*
run:

Cullen
u
thu
Co
eEcho

*/

 



answered Aug 7, 2022 by avibootz
...