PDA

View Full Version : Just get part of a NSString




ctalmeida
May 18, 2011, 02:36 PM
Hi,

Sorry again for the ignorance.

I have a NSString str with "ABCDEFGHI" on it.

I am for many hours trying to find a way to retrive from letter i n letters and have it in another NSString.
Like NSString str2 = [str GETPARTOFSTRINGFROM:2 LENGHT:3] would return

"CDE"

Anyone has a simple routine to do that? Is there a function that would do that?

Thanks again for the help.



robbieduncan
May 18, 2011, 02:44 PM
Open the NSString documentation (http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/Reference/NSString.html) and look at the methods in the section "Dividing Strings"

ctalmeida
May 18, 2011, 02:59 PM
Thank you very much.
Looks like every time I write here I find the answer after that.
You can find that also here
http://macdevcenter.com/pub/a/mac/2001/06/29/cocoa.html?page=3

Open the NSString documentation (http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/Reference/NSString.html) and look at the methods in the section "Dividing Strings"