Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/43.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在iPhone中查找或匹配NSString中的两个字符_Iphone_Nsstring - Fatal编程技术网

如何在iPhone中查找或匹配NSString中的两个字符

如何在iPhone中查找或匹配NSString中的两个字符,iphone,nsstring,Iphone,Nsstring,我正在进行xml解析,其中获取web服务响应 现在在解析中,我需要将currentuserid与userid匹配,如果两者都匹配并且将执行某些条件。我正在进行xml解析,请有人告诉我如何匹配此字符串。使用TBXML解析,它非常容易使用。可能有用吗 TBXML * tbxml = [[TBXML alloc] initWithURL:apiURL]; if(tbxml) { TBXMLElement * root = tbxml.rootXMLElement;

我正在进行xml解析,其中获取web服务响应


现在在解析中,我需要将currentuserid与userid匹配,如果两者都匹配并且将执行某些条件。我正在进行xml解析,请有人告诉我如何匹配此字符串。

使用TBXML解析,它非常容易使用。可能有用吗

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];
}}}}
if ([string1 isEqualToString:string2])
{

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


}