0

I am having a Multi line string(NSSTRING) as below

11501 W SHAWNEE MISSION PKWY

P.O. BOX 3179

Shawnee Mission KS 66203

9132482287

here the line has three \n (3 new lines). Here i want is count of \n .

I googled a lot but could not find it .

Thanks, Mrugen

mrugen munshi
  • 3,497
  • 9
  • 36
  • 50

2 Answers2

1

Here might you get the answer

NSString : number of a word

Community
  • 1
  • 1
V.V
  • 3,082
  • 7
  • 49
  • 83
0

One way is to iterate through the characters in the string and count the number of them that are \n. Another is to split the string on \n, count the number of substrings, and subtract 1. You can do either with NSString's API.