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

  • Home
  • SEARCH
  • 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 6059175
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:40:52+00:00 2026-05-23T08:40:52+00:00

my question is: I have a dictionary with one object for each character of

  • 0

my question is:
I have a dictionary with one object for each character of the alphabet. Within those objects, there are all values for a specific character.

Example:

alphabetDictionary
  a
    apple
    alien
  b 
   balloon
   ball

I now want to count all entries within this dictionary:

apple
alien
balloon
ball
-> 4

Using this sourcecode only counts the objects (a, b, etc)

NSString *counter = [NSString stringWithFormat:@"Entries (%d)", alphabetDictionary.count];

So how do I get all entries and not the objects a,b,etc?

EDIT 1:
In the viewDidLoad Method I have:

//Initialize the array.
charDict = [[NSMutableDictionary alloc] init];
alphabetArray = [[NSMutableArray alloc] init];

if ([charSpecialArray count] > 0)   {

    //Set object for this character within the dictionary
    [charDict setObject:charSpecialArray forKey:@"#"];
    //fill the alphabetArray with an index value, if this char exists at all
    [alphabetArray addObject:@"#"];
}

if ([charAArray count] > 0) {

    [charDict setObject:charAArray forKey:@"A"];
    [alphabetArray addObject:@"A"];
}

etc.. for each character

followed by:

totalCounter = 0;
//Count all keys within the Dictionary
for (id objectKey in charDict.allKeys) {
    totalCounter += [[charDict objectForKey:objectKey] count];
    NSLog(@"Anzahl: %d", totalCounter);
}   
NSString *counter = [NSString stringWithFormat:@"TXNs (%d)", totalCounter];

self.title = counter;

the results are looking much too high:

  • Character H has 33 entries
  • the count of H characters results in: 132
  • m characters: 1587
  • m characters count: 6348

Any ideas why those counts are this high?

  • 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-05-23T08:40:53+00:00Added an answer on May 23, 2026 at 8:40 am

    The solution to my problem is:
    I’ve used NSInteger instead of NSUInteger

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a three part question. One: Would using a Dictionary<String,Object> be a good
I want to show pop up of question with it's options. Each question have
I have a Dictionary that tracks objects (ClientObject). Both the dictionary and ClientObject's are
I recently asked this question: Expose XML or Objects - thanks all for the
I have an expression like this Expression<Func<IInterface, object>> How do i loop/traverse through all
I have a dictionary of objects: # I have thousands of objects in my
I have a general question about objects, memory, and retaining. I am not a
here is my question: I have a plist with some objects in it. These
The responses I've got to this question have solved the problem I had in
No doubt elements of this question have been asked before, but I'm having trouble

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.