NSRange
Subject : NSRange
From: "Mr. Gecko" <email@hidden >
Date: Wed, 14 May 2008 18:25:12 -0500
Delivered-to: email@hidden
Delivered-to: email@hidden
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:to:content-type:mime-version:subject:date:x-mailer:from; bh=Gc7boXvXpX3cZoIIXWOgwQyaH96QH+N6IXkSwWzbl90=; b=QOhUON3AD6BP1q26BazJPWnQOgH/SesFI9l/36wvWs4OBj/kE7miSlXPfSoZ7p6FTauBegEUm6CiKSI9AlbT+9lZCY/Z3oDOtlEYcmGSAn1xeoMASbX3Ojh12FjJ8V7EUartqxyghNwgxhmPDVhwvVmFx8Oha1dT063ARzRQGII=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:to:content-type:mime-version:subject:date:x-mailer:from; b=cNG344vV+SEFKOMvpmlYdL1XoEjnOSVQ7p/I08dFuQ6dxAkpRA5ZJkNB1GCqruWAfv9cgWLdbsxscI8i2QVsp22vt7WB5ybIMj3WsGrXoEiYdKnrXuqJj3qxlUXnpsjkp/9JFv7OxZUrZr1Ppe+7x+8WQWsdPqzfbcHdqvhWgxE=
Hello I am trying to find out how to get characters in the middle of
two characters I have heard of NSRange but I can't find documentation
to it in xcode.
So here is what I am trying to do in this html page on line there are
to points which stays the same and in the middle of the points is what
I need here is an example.
<a href="example.com" title="Ttitle">text I want</a>
so I want to get the text in the middle of points title="Ttitle"> and
</a>
Here is what I tried and did not work
NSString *url = [NSString stringWithContentsOfURL:[NSURL
URLWithString:@"http://www.example.com/file.html" ;]];
NSString *s = url;
NSRange f, l;
f = [url rangeOfString:@"{\" title=\"Ttitle\">"];
if (f.location == NSNotFound) NSLog(@"failed");
s = [s substringFromIndex:f.location + f.length];
l = [s rangeOfString:@",\"</a>\""];
if (l.location == NSNotFound) NSLog(@"failed");
s = [s substringFromIndex:f.location + l.location];
I wanted s to equal the text in the middle but it does not.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden
This email sent to email@hidden
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2007 Apple Inc. All rights reserved.