1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

概要

paiza.ioでelixirやってみた。
URI使ってみた。

サンプルコード


URI.decode("https%3A%2F%2Felixir-lang.org")
|> IO.inspect
URI.decode_query("foo=1&bar=2")
|> IO.inspect
URI.encode("ftp://s-ite.tld/?value=put it+й")
|> IO.inspect
URI.encode("a string", &(&1 != ?i))
|> IO.inspect
query = %{"foo" => 1, "bar" => 2}
URI.encode_query(query)
|> IO.inspect
URI.merge(URI.parse("http://google.com"), "/query") 
|> to_string()
|> IO.inspect
URI.parse("https://elixir-lang.org/")
|> IO.inspect
URI.query_decoder("foo=1&bar=2") 
|> Enum.to_list()
|> IO.inspect
uri = URI.parse("http://google.com")
URI.to_string(uri)
|> IO.inspect


実行結果

"https://elixir-lang.org"
%{"bar" => "2", "foo" => "1"}
"ftp://s-ite.tld/?value=put%20it+%D0%B9"
"a str%69ng"
"bar=2&foo=1"
"http://google.com/query"
%URI{
  authority: "elixir-lang.org",
  fragment: nil,
  host: "elixir-lang.org",
  path: "/",
  port: 443,
  query: nil,
  scheme: "https",
  userinfo: nil
}
[{"foo", "1"}, {"bar", "2"}]
"http://google.com"

成果物

以上。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?