count number of occurrences in string c#

count number of occurrences in string c# 

 First use the following namesapce
          using System.Text.RegularExpressions; 

  Use the following Regx code to count 
           string source="one two three one two one"
           int count = Regex.Matches(source, "\\b(" + Yourstring + ")\\b").Count;
  that "\\b(" is used for eliminate specal charcter.

Comments

Popular posts from this blog

Upload Single/Multiple file by using the REST API and jQuery SharePoint 2013

Add content type to SharePoint List/Library using REST API

A type named 'SP.Data. could not be resolved by the model error