Skip to content

Instantly share code, notes, and snippets.

@kishikawakatsumi
Created September 12, 2011 07:52
Show Gist options
  • Save kishikawakatsumi/1210782 to your computer and use it in GitHub Desktop.
Save kishikawakatsumi/1210782 to your computer and use it in GitHub Desktop.
static inline NSString *convertSelName(const char *hax3d) {
int length = strlen(hax3d);
char name[length + 1];
for (int i = 0; i < length; ++i) {
char c = hax3d[i];
if (c == ':' || c == '_') {
name[i] = c;
} else if (c >= 'a' && c <= 'z') {
name[i] = ((c - 'a' + 13) % 26) + 'a';
} else {
name[i] = ((c - 'A' + 13) % 26) + 'A';
}
}
name[length] = 0;
return [NSString stringWithCString:name encoding:NSUTF8StringEncoding];
}
// Usage
selector = NSSelectorFromString(convertSelName("frgQvzGnoyrIvrjBaRzcglFrnepuFgevat:"));
if ([searchController respondsToSelector:selector]) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment