2

I am using something like:

illegalCharacters = [[NSCharacterSet characterSetWithCharactersInString:@"\x00\.."] retain];

Xcode 4 displays a warning for it

(Semantic issue: CFString literal contains NUL character)

Is there any way to fix that? I need that NUL character because I am stripping those characters defined in my "illegalCharacters" out of a string.

Konerak
  • 39,272
  • 12
  • 98
  • 118
Josh
  • 61
  • 2

1 Answers1

0

Here is one solution:

NSString *charSetStr = [NSString stringWithFormat: @"%C%C%C", 0, 10, 13];
illegalCharacters = [[NSCharacterSet characterSetWithCharactersInString:charSetStr] retain];

This way the string with NUL is not built until runtime and therefore no warnings from the compiler.

helioz
  • 910
  • 11
  • 22