Skip to content

Instantly share code, notes, and snippets.

@quietcricket
Created February 3, 2012 11:00
Show Gist options
  • Save quietcricket/1729667 to your computer and use it in GitHub Desktop.
Save quietcricket/1729667 to your computer and use it in GitHub Desktop.
Solve & problem in URL
NSString* link=[NSString stringWithFormat:@"https://twitter.com/intent/tweet?url=http://google.com&text=",@"Some text that may have & damn you &&&"];
link=[link stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
link=[link stringByReplacingOccurrencesOfString:@"&" withString:@"%26" options:NSLiteralSearch range:NSMakeRange([link rangeOfString:@"&"].location+1, link.length-1)];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment