CSharp examples for System:String Search
count words in this string
using System.Text.RegularExpressions; using System.Linq; using System.Collections.Generic; using System;/*from w w w . ja v a 2s . c om*/ public class Main{ /// <summary> /// count words in this string /// </summary> /// <param name="str">string</param> /// <returns>int</returns> public static int WordCount(this string str) { return str.Split(new[] {' ', '.', '?', '!'}, StringSplitOptions.RemoveEmptyEntries).Length; } }