Created
July 20, 2012 07:33
-
-
Save supermarin/3149303 to your computer and use it in GitHub Desktop.
New: iVars / static vars in OBJC categories
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // NSString+DomainInput.m | |
| // Domainchy | |
| // | |
| // Created by Marin Usalj on 7/13/12. | |
| // Copyright (c) 2012 mneorr.com | @mneorr | [email protected]. All rights reserved. | |
| // | |
| #import "NSString+DomainInput.h" | |
| @implementation NSString (DomainInput) | |
| static NSString *allowedCharacters = @"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLKMNOPQRSTUVWXYZ0123456789-."; | |
| - (BOOL)isAllowedCharacter { | |
| return [allowedCharacters containsString:self]; | |
| } | |
| #pragma mark - Private | |
| - (BOOL)containsString:(NSString *) string { | |
| NSRange range = [self rangeOfString:string options:NSCaseInsensitiveSearch]; | |
| return range.location != NSNotFound; | |
| } | |
| @end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment