Colas
Colas

Reputation: 3573

How to put a non-breaking space in an NSString?

I would like to define an NSString, of length 1, whose only character is a non-breaking space. How should I do ?

Upvotes: 8

Views: 1739

Answers (1)

hamstergene
hamstergene

Reputation: 24439

Use universal character names:

// http://en.wikipedia.org/wiki/Non-breaking_space
NSString* const nonBreakingSpace = @"\u00A0";

// small-u takes four digits, big-u takes eight
// NSString* const nonBreakingSpace = @"\U000000A0";

Upvotes: 15

Related Questions