views:

23

answers:

2

How to get a substring from NSSTring from index 0 to 99. i.e. first 100 characters

+1  A: 
[str substringToIndex: 100]
Matthew Flaschen
Note that the index has to be checked.
Georg Fritzsche
A: 
[myString substringToIndex:100]

You need to be sure that index 100 is valid, i.e. length of string is at least 100. Otherwise an exception will be thrown.

taskinoor