Advertise Books Events Forum News Social Networking Support Us

sdkIQ for iPhone
($4.99)

Shape Up
($0.99)

Your First iPhone App
($1.99)

iVidCam Free
(free)

Kid Art
($0.99)

iPUBQUIZ
(£1.19)

ArtStudio
($3.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 04-16-2008, 08:01 AM   #7 (permalink)
Cander
New Member
 
Join Date: Apr 2008
Posts: 7
Default Re: Pulling Data From A Web Page

I got it working using NSScanner. Works perfectly.

Code:
- (void) getPilots:(NSString *)data { 
 	NSString *foundData = @""; 	
                NSScanner *scanner = [NSScanner scannerWithString:data];
 	// loop through the passed html data 	
                while (![scanner isAtEnd]) {
 		NSInteger leftPos, rightPos;
 		[scanner scanUpToString: @"left text to find" intoString: nil]; 		                leftPos = [scanner scanLocation];
 		 if (![scanner scanUpToString: @"right text to fin" intoString: nil])
 			break; 		 		
                                 rightPos = [scanner scanLocation] + 1;
 		 leftPos += 19; // add the number of characters of the left text to find
 		// get data between the left and right text
                                 foundData = [data substringWithRange: NSMakeRange(leftPos, (rightPos - leftPos) - 2)];
 		[playersArray addObject:foundData]; 
 	}
 }
Yeah the lack of RegEx seems very odd. After years of using it in .NET I feel naked without it.
Cander is offline   Reply With Quote
 
Enter the iPhone App Challenge!  Win $500!
» Advertisements
» Online Users: 270
21 members and 249 guests
Alexman, AlexTheMighty, applezinga, arcturus, Bertrand21, Cathy, Chilibird, embedded, evana, Falcon80, Glnn, headkaze, iSdkDev, jhaynie, kalygraphix, mac514, pereorra, shuvo1879, smrtital, Son of a Beach, tlikyu
Most users ever online was 779, 05-11-2009 at 09:55 AM.
» Stats
Members: 24,228
Threads: 39,008
Posts: 171,100
Top Poster: smasher (2,570)
Welcome to our newest member, SSL Matrix
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 03:48 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.