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

  • 相关阅读:
    JSAJAX请求
    ES6-形参默认值
    ES6-三点运算符
    ES6-箭头函数
    ES6-对象的简写方式
    ES6-使用模板字符串完成字符串拼接
    201712-2 游戏
    Product of Polynomials
    Maximum Subsequence Sum
    蓝桥杯 龟兔赛跑预测
  • 原文地址:https://www.cnblogs.com/tom2015010203/p/5165551.html
Copyright © 2011-2022 走看看