1

I've been Googling, grepping and searching high and low, but can't find the answer. Which header file do I need to include to get the definitions of these constants in iOS?

NSLineSeparatorCharacter
NSNewLineCharacter
NSParagraphSeparatorCharacter
HairOfTheDog
  • 2,489
  • 2
  • 29
  • 35
  • I've tried using all three of them. I get compile errors: `error: use of undeclared identifier 'NSLineSeparatorCharacter' error: use of undeclared identifier 'NSNewLineCharacter' error: use of undeclared identifier 'NSParagraphSeparatorCharacter'` – HairOfTheDog Mar 20 '13 at 23:59
  • @user125697 yeah, I read that. Actually, that question is how I learned that these constants are supposed to exist. Unfortunately it gives me no clue as to where those contants are defined, and neither does the linked Apple documentation on line and paragraph endings – HairOfTheDog Mar 21 '13 at 00:02
  • You read this too right? http://stackoverflow.com/a/6420494/1586880 – dsgriffin Mar 21 '13 at 00:04
  • @user125697 yep, read that too. Did you see the comment someone else posted in that question? It reads "What should I include so I can use NSParagraphSeparatorCharacter" – HairOfTheDog Mar 21 '13 at 00:06
  • So why can't you just hardcode them? Say if you need NSNewLineCharacter you'd use \n for example? or am I missing something – dsgriffin Mar 21 '13 at 00:08

2 Answers2

5

Those constants are defined in NSText.h which is only for OS X, not iOS. Therefore you can't use those constants in iOS.

NSLineSeparatorCharacter is defined as: 0x2028

NSNewLineCharacter is defined as: 0x000a

NSParagraphSeparatorCharacter is defined as: 0x2029

rmaddy
  • 314,917
  • 42
  • 532
  • 579
0

In Swift, this can be defined as:

let NSNewLineCharacter = "\u{000a}"
let NSLineSeparatorCharacter = "\u{2028}"
let NSParagraphSeparatorCharacter = "\u{2029}"
Rudolf Adamkovič
  • 31,030
  • 13
  • 103
  • 118