how to get first three characters of an NSString?

cgossain picture cgossain · Mar 14, 2011 · Viewed 87k times · Source

How can I return the first three characters of an NSString?

Answer

GameLoading picture GameLoading · Mar 14, 2011
 mystr=[mystr substringToIndex:3];

Be sure your string has atleast 3 ch.. o.e. it will crash the app.

Here are some other links to check NSsting operations...

Link1

Link2

Apple Link