Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 02-10-2010, 05:11 AM   #6 (permalink)
sumanth
Registered Member
 
sumanth's Avatar
 
Join Date: Jul 2009
Location: India
Posts: 78
Default

Code:
NSString *full_string=@"The Quick Brown Fox Brown";
	NSMutableArray *countloc=[[NSMutableArray alloc]init];
	int temp=0;
	int len=[full_string length];
	for(int i =0;i<[full_string length];i++)
	{
			NSRange range=[full_string rangeOfString:@"Brown" options:0 range:NSMakeRange(temp,len-1)];
			if(range.location<[full_string length])
			[countloc addObject:[NSString stringWithFormat:@"%d",range.location]];
			temp=range.location+1;
			len=[full_string length]-range.location;
			i=temp;

	}
Here searching for the substring Brown and
Location of the substring is stored in the array countloc
sumanth is offline   Reply With Quote
 

» Advertisements
» Online Users: 785
20 members and 765 guests
ADY, ckgni, dabvid, dfvdan, GFish, GHuebner, ilmman, iph_s, joeallenpro, john love, keeshux, marto1914, Ndpiparava, nfung, nru, tomtom100, VikMyr, waq963, _Mac
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,868
Threads: 89,225
Posts: 380,692
Top Poster: BrianSlick (7,129)
Welcome to our newest member, stokesreece
Powered by vBadvanced CMPS v3.1.0

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