本文簡要介紹ruby語言中 URI.parse
的用法。
用法
parse(uri)
概要
URI::parse(uri_str)
參數
說明
從字符串創建 URI 的子類實例之一。
拋出
URI::InvalidURIError
-
如果給定的
URI
不正確,則引發。
用法
require 'uri'
uri = URI.parse("http://www.ruby-lang.org/")
# => #<URI::HTTP http://www.ruby-lang.org/>
uri.scheme
# => "http"
uri.host
# => "www.ruby-lang.org"
如果有任何無效的 URI
字符,建議首先::escape 提供的uri_str
。
相關用法
- Ruby URI.join用法及代碼示例
- Ruby URI.decode_www_form用法及代碼示例
- Ruby URI.extract用法及代碼示例
- Ruby URI.regexp用法及代碼示例
- Ruby URI.encode_www_form用法及代碼示例
- Ruby URI.split用法及代碼示例
- Ruby URI模塊用法及代碼示例
- Ruby UndefinedConversionError.source_encoding用法及代碼示例
- Ruby UnboundMethod.original_name用法及代碼示例
- Ruby UID.change_privilege用法及代碼示例
- Ruby Util.unescape用法及代碼示例
- Ruby Util.url_encode用法及代碼示例
- Ruby UNIXSocket.new用法及代碼示例
- Ruby UNIXSocket.addr用法及代碼示例
- Ruby UnboundMethod.bind用法及代碼示例
- Ruby UNIXServer.accept用法及代碼示例
- Ruby UNIXSocket.recv_io用法及代碼示例
- Ruby UID.euid用法及代碼示例
- Ruby UncaughtThrowError類用法及代碼示例
- Ruby Util.pretty用法及代碼示例
- Ruby UID.uid用法及代碼示例
- Ruby UnwindDetails.all_requirements用法及代碼示例
- Ruby UnboundMethod類用法及代碼示例
- Ruby UnwindDetails.reversed_requirement_tree_index用法及代碼示例
- Ruby UnboundMethod.parameters用法及代碼示例
注:本文由純淨天空篩選整理自ruby-lang.org大神的英文原創作品 URI.parse。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。