Splits a string containing emails separated by the following characters: [;,\t\r\n] - CSharp System

CSharp examples for System:String Split

Description

Splits a string containing emails separated by the following characters: [;,\t\r\n]

Demo Code

// Copyright (c) 2012 Computer Technology Solutions, Inc.  ALL RIGHTS RESERVED
using System.Text.RegularExpressions;
using System.Text;
using System.Linq;
using System.Globalization;
using System.Collections.Generic;
using System;//from  w  w w.j  a  v a 2s. c om

public class Main{
        /// <summary>
        /// Splits a string containing emails separated by the following characters: [;,\t\r\n]
        /// </summary>
        /// <param name="emails"></param>
        /// <returns></returns>
        public static IList<string> SplitEmails(string emails)
        {
            return Regex.Replace(emails ?? "", "[ ,\t\r\n;]+", ";").Split(';').ToList();
        }
}

Related Tutorials