Search code examples
vbscriptasp-classic

Count how many specific characters in string


I have a search box.

My admin user might search for "@MG @EB dorchester".

In ASP, I need to count how many times the symbol "@" appears in the string. How is the possible?


Solution

  • Try this:

    len(yourString) - len(replace(yourString, "@", ""))