DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Deane has posted 1 posts at DZone. View Full User Profile

Find The Count Of A Given Character In A Text String

  • submit to reddit
        ASP / VBScript offers no built-in functionality for this.

CharacterCount = Len(MyString) - Len(Replace(MyString, TargetCharacter, ""))


Snippets Manager replied on Tue, 2011/07/26 - 2:22pm

arrCount = Split(MyString, TargetCharacter, -1 1) CharacterCount = UBound(arrCount)