Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

count number of specific characters in string c#

# cCopyusing System;
using System.Linq;

namespace get_first_char_of_string
{
    class Program
    {
        static void Main(string[] args)
        {
            string source = "/once/upon/a/time/";
            int count = source.Split('o').Length - 1; 
            Console.WriteLine(count);
        }
    }
}
Source by www.delftstack.com #
 
PREVIOUS NEXT
Tagged: #count #number #specific #characters #string
ADD COMMENT
Topic
Name
8+9 =