Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7807297
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T02:48:43+00:00 2026-06-02T02:48:43+00:00

I am basically pasting this from another forum where I saw it asked (with

  • 0

I am basically pasting this from another forum where I saw it asked (with nobody answering). It is essentially the exact same thing im trying to do:

In ASP classic, is there a way to count the number of times a string appears in an array of strings and output them based on string and occurrence count?

For example if I have an array which contains the following :
hello
happy
hello
hello
testing
hello
test
happy

The output would be:

hello 4
happy 2
test 1
testing 1

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T02:48:45+00:00Added an answer on June 2, 2026 at 2:48 am

    I’m assuming the language is VBScript (since that’s what most people use with classic ASP).

    You can use a Dictionary object to keep track of the individual counts:

    Function CountValues(pArray)
        Dim i, item
        Dim dictCounts
        Set dictCounts = Server.CreateObject("Scripting.Dictionary")
    
        For i = LBound(pArray) To UBound(pArray)
            item = pArray(i)
            If Not dictCounts.Exists(item) Then
                dictCounts.Add item, 0
            End If
            dictCounts.Item(item) = dictCounts.Item(item) + 1
        Next
    
        Set CountValues = dictCounts
    End Function
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Having some trouble passing values from one class to another. I basically have a
I'm trying to keep from cutting and pasting code so I made a wrapper
Basically what I'm trying to achieve is to make the object reference another object
Basically I want to go from -1 to 1 in n steps, including -1
Is it possible to catch an exception thrown from one thread in another thread?
Basically I just need the effect of copying that HTML from browser window and
I'm trying to access a form's recordset clone from a called function which we're
I have another beginner's question that hopefully someone can help with. I'm trying to
I have another question, not sure if this would be accomplished via PHP or
I've been trying to get this to work for days upon days and it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.