In this example we see how we could play with multiple whitespace characters in side split function in C#.
Output:
using System;
using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace Split_By_Any_Char{class Program{static void Main(String[] args){string str = Console.ReadLine();// "He is a very very good boy, isn't he?";var arr = str.Split(("![,?.\\~ '@+]").ToArray());Console.WriteLine(arr.Where(a=> a.Trim() !="").Count());//Total no of wordforeach (var c in arr){if (c.Trim() != ""){Console.WriteLine(c);}}Console.Read();}}}
Output: