Skip to content

Commit

Permalink
code clean
Browse files Browse the repository at this point in the history
  • Loading branch information
lixian committed Oct 11, 2017
1 parent 02df93d commit 9527707
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions LxFTPRequest/LxFTPRequest.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ @implementation NSString (ftp)

- (BOOL)isValidateFTPURLString {
if (self.length > 0) {
return [[NSPredicate predicateWithFormat:@"SELF MATCHES %@", @"^[Ff][Tt][Pp]://(\\w*(:[=_0-9a-zA-Z\\$\\(\\)\\*\\+\\-\\.\\[\\]\\?\\\\\\^\\{\\}\\|`~!#%&\'\",<>/]*)?@)?([0-9a-zA-Z]+\\.)+[0-9a-zA-Z]+(:(6553[0-5]|655[0-2]\\d|654\\d\\d|64\\d\\d\\d|[0-5]?\\d?\\d?\\d?\\d))?(/?|((/[=_0-9a-zA-Z\\-%]+)+(/|\\.[_0-9a-zA-Z]+)?))$"] evaluateWithObject:self];
return [[NSPredicate predicateWithFormat:@"SELF MATCHES %@", @"^[Ff][Tt][Pp]://(\\w*(:[=_0-9a-zA-Z\\$\\(\\)\\*\\+\\-\\.\\[\\]\\?\\\\\\^\\{\\}\\|`~!#%&\'\",<>/]*)?@)?([0-9a-zA-Z\\-]+\\.)+[0-9a-zA-Z]+(:(6553[0-5]|655[0-2]\\d|654\\d\\d|64\\d\\d\\d|[0-5]?\\d?\\d?\\d?\\d))?(/?|((/[=_0-9a-zA-Z\\-%]+)+(/|\\.[_0-9a-zA-Z]+)?))$"] evaluateWithObject:self];
} else {
return NO;
}
Expand All @@ -29,8 +29,11 @@ - (BOOL)isValidateFileURLString {

- (NSString *)stringByDeletingScheme {
NSRange range = [self rangeOfString:@"://"];

return [self substringFromIndex:(range.location + range.length)];
if (range.location != NSNotFound) {
return [self substringFromIndex:(range.location + range.length)];
} else {
return nil;
}
}

- (NSString *)stringDecorateWithUsername:(NSString *)username password:(NSString *)password {
Expand Down

0 comments on commit 9527707

Please sign in to comment.