I am trying to use rangeOfCharacterFromSet to make sure that a set of categories do not contain any special characters. This is how I am trying to do it:
When I step through the debugger the and print description of the variables I get :
doNotWant
Printing description of doNotWant:
<CFCharacterSet Items(U+0026 U+002A U+002F U+003A U+003C U+003E U+003F U+007C)>
Printing description of info.CategoryDescription:
Tracy Debbie
As you can see there are not any of those special characters, but I still hit the validation line. No matter what I put in there I get to that line. I am sure I am doing something stupid because every sample I have seen seems extremely easy, but I can not get it.
Please Help.
Code:
NSCharacterSet * doNotWant = [[NSCharacterSet characterSetWithCharactersInString:@":/|&*<>?"] invertedSet];
NSRange inRange;
for ( Proof * info in [ProofCategoriesController arrangedObjects])
{
inRange = [info.CategoryDescription rangeOfCharacterFromSet:doNotWant];
if (inRange.location != NSNotFound)
[validationitems addObject:[ValidationItem InitWithValues:@"The Gallery name cannot contain any of the following characters: \" / : * ? & < > | " button:button]];
}
When I step through the debugger the and print description of the variables I get :
doNotWant
Printing description of doNotWant:
<CFCharacterSet Items(U+0026 U+002A U+002F U+003A U+003C U+003E U+003F U+007C)>
Printing description of info.CategoryDescription:
Tracy Debbie
As you can see there are not any of those special characters, but I still hit the validation line. No matter what I put in there I get to that line. I am sure I am doing something stupid because every sample I have seen seems extremely easy, but I can not get it.
Please Help.