/
string source = "/once/upon/a/time/";int count = source.Length - source.Replace("/", "").Length;
RegEx
string haystack = "/once/upon/a/time";string needle = "/";int needleCount = ( haystack.Length - haystack.Replace(needle,""). Length ) / needle.Length;
如何计算字符串中出现的字符串(实际上是字符)?
倚天杖
慕仙森
相关分类