首页  编辑  

统计子串出现的次数

Tags: /C#/字符串处理/   Date Created:

string Str = "hello zswang you ok? zswang ;

string Sub = "zswang" ;

int Cnt = (Str . Length - Str . Replace(Sub, "" ) . Length) / Sub . Length;