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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T20:14:18+00:00 2026-06-06T20:14:18+00:00

Possible Duplicate: How do I compare strings in objective c? Objective-C If statement? When

  • 0

Possible Duplicate:
How do I compare strings in objective c?
Objective-C If statement?

When I try to compare strings in Objective-C using the == factor I am not getting any result. What I am doing is having an XML document and then retrieving the value “day” and then comparing those. But as I said nothing happens.

XML Code:

<dagensretlist>
<dagensret>
<day>mandag</day>
<date>Mandag 2. juli</date>
<name>Kylling fillet med rosti og salat</name>
<description>Den sprodeste kyllingfillet med Antons piksved</description>
</dagensret>

<dagensret>
    <day>tirsdag</day>
<date>Tirsdag 3. juli</date>
<name>Kylling fillet med rosti og salat</name>
<description>Den sprodeste kyllingfillet med Antons piksved</description>
</dagensret>

<dagensret>
    <day>onsdag</day>
<date>Onsdag 4. juli</date>
<name>Kylling fillet med rosti og salat</name>
<description>Den sprodeste kyllingfillet med Antons piksved</description>
</dagensret>

<dagensret>
<day>torsdag</day>
    <date>Torsdag 5. juli</date>
<name>Kylling fillet med rosti og salat</name>
<description>Den sprodeste kyllingfillet med Antons piksved</description>
</dagensret>

<dagensret>
    <day>fredag</day>
<date>Fredag 6. juli</date>
<name>Kylling fillet med rosti og salat</name>
<description>Den sprodeste kyllingfillet med Antons piksved</description>
</dagensret>
</dagensretlist>

The code itself:

- (void)getCurrencyList {
    NSArray *currencyList = [self getAllItems:@"//dagensret" fileName:@"dagensret.xml"];
    int numberOfCurrencies = [currencyList count];
    
    NSString *name, *date, *description, *day;
    if (numberOfCurrencies > 0) {
        for (int i = 0; i < numberOfCurrencies; i++) {
            
            name            = [[currencyList objectAtIndex:i] objectForKey:@"name"];
            day             = [[currencyList objectAtIndex:i] objectForKey:@"day"];
            date            = [[currencyList objectAtIndex:i] objectForKey:@"date"];
            description     = [[currencyList objectAtIndex:i] objectForKey:@"description"];
            
            if(day==@"1"){
                NSLog(@"day: %@, date: %@, name: %@, description: %@", day, date, name, description);
                NSLog(@"1");
            }
            if(day==@"tirsdag"){
                NSLog(@"day: %@, date: %@, name: %@, description: %@", day, date, name, description); 
            }
            if(day==@"onsdag"){
                NSLog(@"day: %@, date: %@, name: %@, description: %@", day, date, name, description); 
            } 
            if(day==@"torsdag"){
                NSLog(@"day: %@, date: %@, name: %@, description: %@", day, date, name, description); 
            } 
            if(day==@"fredag"){
                NSLog(@"day: %@, date: %@, name: %@, description: %@", day, date, name, description); 
            }             
            
        }
    }
}

Is this a wrong way to compare strings to a variable?

Thank you!

  • 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-06T20:14:22+00:00Added an answer on June 6, 2026 at 8:14 pm

    Use isEqualToString from NSString class to compare strings

    documentation

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

Sidebar

Related Questions

Possible Duplicate: javascript compare strings without being case sensitive. I am having two fields.
Possible Duplicate: A better way to compare Strings which could be null I have
Possible Duplicate: Compare dates in java I am getting two dates from server in
Possible Duplicate: How do I compare strings in Java? String s1 = andrei; String
Possible Duplicate: Compare using Thread.Sleep and Timer for delayed execution I am considering whether
Possible Duplicate: How to compare strings? ( == returns wrong value) I have the
Possible Duplicate: How do I compare strings in Java? why first comparison ( s1
Possible Duplicate: How does Python compare string and int? Can any one explain the
Possible Duplicate: Differences in string compare methods in C# Is there any difference between
Possible Duplicate: How to compare 2 files fast using .NET? How can I compare

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.