开发者

Change HTML characters in URL in xcode

开发者 https://www.devze.com 2023-03-03 14:41 出处:网络
given a URL like this: http%3A%2F%2Fwww.environmental-expert.com%2FresultEachPressRelease.aspx%3Fcid%3D23745%26codi%3D2开发者_StackOverflow34441%26lr%3D1

given a URL like this:

http%3A%2F%2Fwww.environmental-expert.com%2FresultEachPressRelease.aspx%3Fcid%3D23745%26codi%3D2开发者_StackOverflow34441%26lr%3D1

How can i replace the characters (like %3D and so on) to get a normal url using the iphone sdk?

thanks in advance!


Try:

NSString *myEscapedUrl = @"http%3A%2F%2Fwww.environmental-expert.com%2FresultEachPressRelease.aspx%3Fcid%3D23745%26codi%3D234441%26lr%3D1";

NSLog(@"my unescaped url: %@", [myEscapedUrl stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]);
0

精彩评论

暂无评论...
验证码 换一张
取 消