Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Characters that need to be escaped in an Objective-C NSString object

Tags:

objective-c

Want to know the whole character set whose characters have to be escaped in an Objective-C NSString object in order to be recognized properly, e.g. " has to be escaped as \", as in

NSString *temporaryString = @"That book is dubbed as \"the little book\".";

Is the character set same with the one in C language char * string?

Thanks for your help :D

like image 750
George Avatar asked May 22 '13 02:05

George


Video Answer


1 Answers

The only characters that have to be escaped are the " (double-quote) and \ (backslash) characters.

There are other special character literals such as \n that have special meaning but those are really a separate issue.

Objective-C NSString values use the same set of special character literals as C.

like image 78
rmaddy Avatar answered Oct 02 '22 03:10

rmaddy