查看第二个参数在第一个参数中出现的次数

来源:互联网 发布:六间房软件下载 编辑:程序博客网 时间:2024/05/17 03:31
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace testfour{    class Program    {        static void Main(string[] args)        {            MyClass myclass = new MyClass();            int num =  myclass.CountChar("fdfdfdfcxvcxcdfsdffvcdv", 'd');            Console.WriteLine(num);            Console.Read();        }    }    class MyClass    {        public         int CountChar(String str,char ch)        {            return str.Split(ch).Length - 1;        }    }}

0 0
原创粉丝点击