user1237473
user1237473

Reputation: 69

How to find or match two characher in NSString in iPhone

I am doing xml parsing in which getting web services response

http://layzrd.gets-it.net:8889/ProfilePage.aspx?currentuserid=6&userid=6

now in parsing i need to match the currentuserid with userid , if both matches and some condition will be executed. I am doing xml parsing, Would some one please let me know how to match this string.

Upvotes: 0

Views: 89

Answers (2)

Ranga
Ranga

Reputation: 821

if ([string1 isEqualToString:string2])
{

    //Strings compared do ur operations here
    /* returs yes (1) if both strings are equal else retur no (0)


}

Upvotes: 0

gauravds
gauravds

Reputation: 3011

use TBXML parsing and it is very easy to use. May be it work

TBXML * tbxml = [[TBXML alloc] initWithURL:apiURL];
    if(tbxml)
    {

        TBXMLElement * root = tbxml.rootXMLElement; 

        if (root) 
        {  
            NSString * replyCode = [TBXML valueOfAttributeNamed:@"replyCode" forElement:root];

            if ([replyCode isEqualToString:@"success"])
            {
                TBXMLElement * Notifications    = [TBXML childElementNamed:@"Notifications" parentElement:root];
                TBXMLElement * Notification = [TBXML childElementNamed:@"Notification" parentElement:Notifications];
                while (Notification != nil) 
                {

                    NSString *idOfMessage = [TBXML valueOfAttributeNamed:@"id" forElement:Notification];
                    NSString *storeName = [TBXML valueOfAttributeNamed:@"storeName" forElement:Notification];
}}}}

Upvotes: 1

Related Questions