计算字符串中的特定字符数

The*_*ver 21 vbscript asp-classic

我有一个搜索框.

我的管理员用户可能会搜索"@MG @EB dorchester".

在ASP中,我需要计算符号"@"出现在字符串中的次数.怎么可能?

And*_*are 42

试试这个:

len(yourString) - len(replace(yourString, "@", ""))
Run Code Online (Sandbox Code Playgroud)


小智 8

Response.write ubound(split(str,"@"))
Run Code Online (Sandbox Code Playgroud)

足以计算特定字符的出现