美文网首页
百分比编码/解码

百分比编码/解码

作者: MxlZlh | 来源:发表于2018-11-01 17:32 被阅读37次
    NSString *urlStr = @"https://www.baidu.com";
    NSString *urlStr1 = @"file:///private/var/mobile/Containers/Data/Application/7E0A28EC-A05E-467E-9DE9-8B76D213F98C/Documents/Inbox/%E4%BA%A7%E5%93%81%E6%8E%A8%E4%BB%8B-%E4%B8%AD%E2%80%BB%E9%87%91%E4%BA%91%E4%BA%92%E8%81%94%E7%BD%91%E6%95%B0%E5%AD%97%E5%9C%B0%E4%BA%A7%EF%BC%88IDC%EF%BC%89%E5%B9%B6%E8%B4%AD%E5%9F%BA%E9%87%91_379460.pdf";
    NSString *urlStr2 = @"file:///private/var/mobile/Containers/Data/Application/F906495D-160A-44A3-B8B6-E8BDEB32EA93/Documents/Inbox/JuZhuZhengJiFengBiao.pdf";
    
    urlStr = [urlStr stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLUserAllowedCharacterSet]];
    NSLog(@"百分比编码:%@",urlStr);
    urlStr = [urlStr stringByRemovingPercentEncoding];
    NSLog(@"解码:%@",urlStr);
    

    相关文章

      网友评论

          本文标题:百分比编码/解码

          本文链接:https://www.haomeiwen.com/subject/hugxxqtx.html