-1

我如何从以下获取网址

[bpfb_link url='http://www.abcd.com/' title='abcd Technologies:: Home Page' image='http://www.abcd.com//images/itwall_b1.gif'] [/bpfb_link ]

上面的链接我retrievedphp方法变成了一个。xml我怎样才能formatted urlabove tag. 我想用它componentsseperatedBystring来获取字符串,但格式每次都会改变。我正在执行以下操作以删除不需要的字符串

NSRange rangeLink = [[[arrUpdates valueForKeyPath:@"content"]objectAtIndex:intIndexPath] rangeOfString:@"bpfb_link"];
            if (rangeLink.location != NSNotFound) 
            {

            NSArray *arrNewLink=[[[arrUpdates valueForKeyPath:@"content"]objectAtIndex:intIndexPath] componentsSeparatedByString:@"["];
                NSLog(@"arrNewLink  %@",[arrNewLink objectAtIndex:0]);
                //[[arrNewLink objectAtIndex:1] componentsSeparatedByString:@"]"];

                NSArray *arrEditedLinks=[[arrNewLink objectAtIndex:1]componentsSeparatedByString:@"]"];
                 NSLog(@"arrEditedLinks  %@",[arrEditedLinks objectAtIndex:1] );
}

请帮帮我

4

1 回答 1

0

如果你的反应是恒​​定的,那么你可以这样做

NSString *temp=@"[bpfb_link url='http://www.abcd.com/' title='abcd Technologies : : Home Page' image='http://www.abcd.com//images/itwall_b1.gif'] [/bpfb_link]";
    NSArray *arr=[[NSArray alloc]init];
    arr=[temp componentsSeparatedByString:@"'"];
    NSLog(@"arr %@",[arr objectAtIndex:1]);

输出是——http ://www.abcd.com/

于 2012-12-12T13:11:44.487 回答