zoukankan      html  css  js  c++  java
  • NSUrl

        NSString *urlString = [NSString stringWithFormat:@"http://www.baidu.com/search?id=1"];

        NSURL __unused *url = [NSURL URLWithString:urlString];

        NSLog(@"协议===%@ ",[url scheme]);// 协议

        NSLog(@"域名==%@ ",[url host]);// 域名

        NSLog(@"完整的url字符串==%@ ",[url absoluteString]);//完整的url字符串

        NSLog(@"relativePath: %@", [url relativePath]); //相对路径 search

        NSLog(@"port :%@", [url port]);  // 端口

        NSLog(@"path: %@", [url path]);  // 路径 search

        NSLog(@"pathComponents:%@", [url pathComponents]); // search

        NSLog(@"Query:%@", [url query]);  //参数 id=1

     

     

     11:03:22.145 ExerciseCopyRetain[1141:29782] 协议===http

     11:03:22.146 ExerciseCopyRetain[1141:29782] 域名==www.baidu.com

     11:03:22.146 ExerciseCopyRetain[1141:29782] 完整的url字符串==http://www.baidu.com/search?id=1

     11:03:22.146 ExerciseCopyRetain[1141:29782] relativePath: /search

     11:03:22.146 ExerciseCopyRetain[1141:29782] port :(null)

     11:03:22.147 ExerciseCopyRetain[1141:29782] path: /search

     11:03:22.147 ExerciseCopyRetain[1141:29782] pathComponents:(

        "/",

        search

    )

     11:03:22.147 ExerciseCopyRetain[1141:29782] Query:id=1

  • 相关阅读:
    Docker
    Docker
    Docker
    Docker
    Docker
    Docker
    pandas——向已经存在的excel数据写入data
    python——利用UI选择路径
    python——装饰器的使用
    python——生成器(协程)gevent多任务
  • 原文地址:https://www.cnblogs.com/tom2015010203/p/5165551.html
Copyright © 2011-2022 走看看