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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T20:24:42+00:00 2026-05-18T20:24:42+00:00

Merry Christmas!!! I’ve ran into a little issue and I need help. I have

  • 0

Merry Christmas!!! I’ve ran into a little issue and I need help. I have NSString that is like so:

NSString *newStr = [someString substringFromIndex:(someNum)];

I’m trying to define (someNum) globally. I believe it needs a NSUInteger to work probably. The reason I need it defined globally is because I’m using some “if statements” to define someNum and someNum will return undeclared if not global. Is it possible to use a objectForKey with this NSString? I’m just stuck on what to do. I tried to define someNum with:

#define someNum 5

but I will have multiple instances of someNum and it won’t work. Like so:

if (someName = @"abc"){
#define someNum 5
}
if (someName = @"abcd"){
#define someNum 6
}
NSString *newStr = [someString substringFromIndex:(someNum)];

I also tried:

if (someName = @"abc"){
NSUInteger someNum = 5;
}
if (someName = @"abcd"){
NSUInteger someNum = 6;
}
NSString *newStr = [someString substringFromIndex:(someNum)];
  • 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-18T20:24:42+00:00Added an answer on May 18, 2026 at 8:24 pm

    Your if statements are completely incorrect, you are performing pointer comparison on the objects, you need to use NSString‘s isEqualToString: method:

    extern NSUInteger someNum;
    
    if([someName isEqualToString:@"abc"]) {
       someNum = 5;
    } else if([someName isEqualToString:@"abcd"]) {
       someNum = 6;
    }
    
    NSString *newStr = [someString substringFromIndex:someNum];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Merry Christmas!!! I've ran into a little issue and I need help. I have
Merry Christmas everyone. I do have a question before Santa arrives. I'm new with
Merry Christmas guys, I found a code that displays a loading message using a
Merry Christmas. I have two questions on In App Purchase. iAP application process: do
Merry Christmas. I have a view which contains a uitableview. Iam using wepopover to
I have a string 'Merry Christmas'. I want to separate this one as 'Merry'
Merry Christmas everybody!!! I have a personal message system in my page. To show
First of all, merry christmas to all of you :) I have a blog,
I have a internal website that users log into. This data is saved as
I have two tables with the same structure: id name 1 Merry 2 Mike

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.