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

Helpdesk App using Power App

Add content type to SharePoint List/Library using REST API

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