NSString gets 100 characters from the start

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

+4
source share
2 answers
  [myString substringToIndex: 100]

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

+6
source
[str substringToIndex: 100] 
+1
source

Source: https://habr.com/ru/post/1315056/


All Articles