var url = URL(string: "http://user:password@www.example.com:8080/hoge/fuga/index.html?a=1&b=2#test")
print("absoluteString :", url?.absoluteString ?? "")
/* absoluteString : http://user:password@www.example.com:8080/hoge/fuga/index.html?a=1&b=2#test */
print("absoluteURL :", url?.absoluteURL ?? "")
/* absoluteURL : http://user:password@www.example.com:8080/hoge/fuga/index.html?a=1&b=2#test */
print("baseURL :", url?.baseURL ?? "")
/* baseURL : */
print("fragment :", url?.fragment ?? "")
/* fragment : test */
print("host :", url?.host ?? "")
/* host : www.example.com */
print("lastPathComponent :", url?.lastPathComponent ?? "")
/* lastPathComponent : index.html */
print("password :", url?.password ?? "")
/* password : password */
print("path :", url?.path ?? "")
/* path : /hoge/fuga/index.html */
print("pathComponents :", url?.pathComponents ?? "")
/* pathComponents : ["/", "hoge", "fuga", "index.html"] */
print("pathExtension :", url?.pathExtension ?? "")
/* pathExtension : html */
print("port :", url?.port ?? "")
/* port : 8080 */
print("query :", url?.query ?? "")
/* query : a=1&b=2 */
print("relativePath :", url?.relativePath ?? "")
/* relativePath : /hoge/fuga/index.html */
print("relativeString :", url?.relativeString ?? "")
/* relativeString : http://user:password@www.example.com:8080/hoge/fuga/index.html?a=1&b=2#test */
print("scheme :", url?.scheme ?? "")
/* scheme : http */
print("user :", url?.user ?? "")
/* user : user */
Created
April 23, 2018 10:37
-
-
Save KentarouKanno/d0e9cc67610fe3ea2a3ffb506cb9bac6 to your computer and use it in GitHub Desktop.
URL
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment