From 0898dd7e4da0becb043f3ae3d37ccc4c0c13c44e Mon Sep 17 00:00:00 2001 From: Bibiko Date: Thu, 25 Nov 2010 23:02:27 +0000 Subject: =?UTF-8?q?=E2=80=A2=20added=20method=20'rot13'=20to=20NSString=20?= =?UTF-8?q?=E2=80=A2=20Bundle=20Editor=20-=20fixed=20several=20GUI=20issue?= =?UTF-8?q?s=20-=20added=20the=20chance=20to=20add=20meta=20data=20to=20ea?= =?UTF-8?q?ch=20bundle=20-=20each=20added/duplicated=20bundle=20will=20get?= =?UTF-8?q?=20an=20unique=20UUID=20in=20order=20to=20be=20able=20to=20iden?= =?UTF-8?q?tify=20a=20Bundle=20for=20future=20purposes=20like=20an=20updat?= =?UTF-8?q?e=20detection=20for=20installed=20bundles=20-=20changed=20init?= =?UTF-8?q?=20process?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/SPStringAdditions.m | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'Source/SPStringAdditions.m') diff --git a/Source/SPStringAdditions.m b/Source/SPStringAdditions.m index 1f9f2738..1185756b 100644 --- a/Source/SPStringAdditions.m +++ b/Source/SPStringAdditions.m @@ -156,6 +156,41 @@ return [newUUID autorelease]; } +/** + * 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. */ -- cgit v1.2.3