Click here to Skip to main content
15,896,349 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
NSString *str1=@"Hello"; // What is Index of 'H' is it 0 or 1 ?
NSString *str2=@"This is my 2nd string";
NSString *temp;
temp=[str1 substringToIndex:2]; // " substringToIndex " -- what it means upto index
NSLog(@"Substring -- %@",temp); // 2 or from 0 to 1 ??
Posted

1 solution

You might want to have a look at the following link with some good info on this:
http://pw1.netcom.com/~tjensen/ptr/pointers.htm[^]

Good luck!
 
Share this answer
 
Comments
bhambhu 28-Feb-12 5:46am    
What i am asking is that if we use " substringToIndex:4 " , then what we get ? we get first 4 character from the string or characters upto the index 4 ?
E.F. Nijboer 28-Feb-12 7:23am    
First 4, check the following: http://www.codesnipr.com/snippet/384/Objective-C-Substring-using-substringToIndex-and-substringFromIndex-

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900