目前我正在使用类似以下的方法:
string source = "/once/upon/a/time/";
int count = source.Length - source.Replace("/", "").Length;
或者对于长度大于1的字符串:
string haystack = "/once/upon/a/time";
string needle = "/";
int needleCount = ( haystack.Length - haystack.Replace(needle,"").Length ) / needle.Length;
LEN(ColumnToCheck) - LEN(REPLACE(ColumnToCheck,"N",""))
。 - Sheridan