-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
61 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// | ||
// NSString+EString.h | ||
// iLcatraz | ||
// | ||
// Created by Macmini on 09.03.15. | ||
// Copyright (c) 2015 dsa. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
@interface NSString (EString) | ||
- (NSString *)urlencode; | ||
@end |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// | ||
// NSString+EString.m | ||
// iLcatraz | ||
// | ||
// Created by Macmini on 09.03.15. | ||
// Copyright (c) 2015 dsa. All rights reserved. | ||
// | ||
|
||
#import "NSString+EString.h" | ||
|
||
@implementation NSString (EString) | ||
- (NSString *)urlencode { | ||
NSMutableString *output = [NSMutableString string]; | ||
const unsigned char *source = (const unsigned char *)[self UTF8String]; | ||
unsigned long sourceLen = strlen((const char *)source); | ||
for (int i = 0; i < sourceLen; ++i) { | ||
const unsigned char thisChar = source[i]; | ||
if (thisChar == ' '){ | ||
[output appendString:@"+"]; | ||
} else if (thisChar == '.' || thisChar == '-' || thisChar == '_' || thisChar == '~' || | ||
(thisChar >= 'a' && thisChar <= 'z') || | ||
(thisChar >= 'A' && thisChar <= 'Z') || | ||
(thisChar >= '0' && thisChar <= '9')) { | ||
[output appendFormat:@"%c", thisChar]; | ||
} else { | ||
[output appendFormat:@"%%%02X", thisChar]; | ||
} | ||
} | ||
return output; | ||
} | ||
@end |
This file contains 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
This file contains 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