Split By Word - CSharp System

CSharp examples for System:String Split

Description

Split By Word

Demo Code


using System.Text.RegularExpressions;
using System.Linq;
using System.Collections.Generic;
using System;/*w  ww  .j  a va 2  s  . c  o  m*/

public class Main{
        public static IEnumerable<string> SplitByWord(string data)
        {
            var regexp = new Regex(@"(\n|\r\n| |\t)");

            return regexp.Split(data).Select(x => x.Trim()).Where(x => !String.IsNullOrWhiteSpace(x));
        }
}

Related Tutorials