aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPStringAdditions.m
diff options
context:
space:
mode:
Diffstat (limited to 'Source/SPStringAdditions.m')
-rw-r--r--Source/SPStringAdditions.m35
1 files changed, 35 insertions, 0 deletions
diff --git a/Source/SPStringAdditions.m b/Source/SPStringAdditions.m
index 1f9f2738..1185756b 100644
--- a/Source/SPStringAdditions.m
+++ b/Source/SPStringAdditions.m
@@ -157,6 +157,41 @@
}
/**
+ * Returns ROT13 representation
+ */
+- (NSString *)rot13
+{
+ NSMutableString *holder = [[NSMutableString alloc] init];
+ unichar theChar;
+ int i;
+
+ for(i = 0; i < [self length]; i++) {
+ theChar = [self characterAtIndex:i];
+ if(theChar <= 122 && theChar >= 97) {
+ if(theChar + 13 > 122)
+ theChar -= 13;
+ else
+ theChar += 13;
+ [holder appendFormat:@"%C", (char)theChar];
+
+
+ } else if(theChar <= 90 && theChar >= 65) {
+ if((int)theChar + 13 > 90)
+ theChar -= 13;
+ else
+ theChar += 13;
+
+ [holder appendFormat:@"%C", theChar];
+
+ } else {
+ [holder appendFormat:@"%C", theChar];
+ }
+ }
+
+ return [NSString stringWithString:holder];
+}
+
+/**
* Escapes HTML special characters.
*/
- (NSString *)HTMLEscapeString