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 9256887
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:04:58+00:00 2026-06-18T12:04:58+00:00

I have an NSMutableArray of playing cards. For brevity, I’ll just show the objects

  • 0

I have an NSMutableArray of playing cards. For brevity, I’ll just show the objects in the suit of clubs, but all 52 cards are present in this array.

deckOfCards = [[NSMutableArray alloc] initWithObjects:
         @"AC",
         @"2C",
         @"3C",
         @"4C",
         @"5C",
         @"6C",
         @"7C",
         @"8C",
         @"9C",
         @"10C",
         @"JC",
         @"QC",
         @"KC",...nil];

I need to assign each of these objects their corresponding numerical value (i.e., A = 1, J = 10, etc.), but preferably without stripping the suit identifiers (such as “C” for clubs) off of the objects. As an extra obstacle, there is a shuffling method which is required (which uses the code found here), which I think would prevent making a second array of the proper numbers to check against the main array.

Is there a method to check for a specific object in an array, and set a numerical value for it? (similar to setting tags for elements in Interface Builder) Is my approach correct?

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-18T12:05:00+00:00Added an answer on June 18, 2026 at 12:05 pm

    Personally, I would make a Card class, and that class would have properties for the numerical value and the suit. Then, you can just add those cards to the array. Shuffling simply uses the indexes of the array, so there no need to worry messing up that part of it.

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

Sidebar

Related Questions

I have NSMutableArray with objects like this : 0,1,0,1,1,1,0,0 And i need to get
I have an NSMutableArray of objects in Objective C. I'm filling this up based
i have NSMutableArray contains NSArray Objects, it looks like this ( 2012-10-10 13:13:29 +0000,
I have an NSMutableArray which has five objects in it. I want to insert
I have a NSMutableArray called putNumberUsed. It contains the following objects @blah1,@blah2,@blah3,@blah4. I want
I have a NSMutableArray of objects, below is the struct: //object at index i
I have a NSMutableArray pages with several objects (instances of Page ). Each Page
I have an NSMutableArray that is populated with objects of strings. For simplicity sake
I have an NSMutableArray of Model objects. Each Model Object has a startTime property
I have an NSMutableArray that is holding a list of objects. What I am

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.