本文簡要介紹ruby語言中 Resolv::DNS::Name.subdomain_of?
的用法。
用法
subdomain_of?(other)
如果 other
是子域,則返回 true。
例子:
domain = Resolv::DNS::Name.create("y.z")
p Resolv::DNS::Name.create("w.x.y.z").subdomain_of?(domain) #=> true
p Resolv::DNS::Name.create("x.y.z").subdomain_of?(domain) #=> true
p Resolv::DNS::Name.create("y.z").subdomain_of?(domain) #=> false
p Resolv::DNS::Name.create("z").subdomain_of?(domain) #=> false
p Resolv::DNS::Name.create("x.y.z.").subdomain_of?(domain) #=> false
p Resolv::DNS::Name.create("w.z").subdomain_of?(domain) #=> false
相關用法
- Ruby Name.new用法及代碼示例
- Ruby Name.to_s用法及代碼示例
- Ruby NameError類用法及代碼示例
- Ruby Name類用法及代碼示例
- Ruby NameError.new用法及代碼示例
- Ruby NilClass.to_f用法及代碼示例
- Ruby NilClass.to_d用法及代碼示例
- Ruby NilClass.to_a用法及代碼示例
- Ruby NilClass.to_h用法及代碼示例
- Ruby NilClass.to_i用法及代碼示例
- Ruby Numeric truncate()用法及代碼示例
- Ruby Numeric rect()用法及代碼示例
- Ruby NotifyTemplateEntry類用法及代碼示例
- Ruby Numeric.i用法及代碼示例
- Ruby Numeric angle()用法及代碼示例
- Ruby Nodes模塊用法及代碼示例
- Ruby Numeric phase()用法及代碼示例
- Ruby NoMethodError類用法及代碼示例
- Ruby Numeric div()用法及代碼示例
- Ruby Numeric integer()用法及代碼示例
- Ruby Numeric positive?用法及代碼示例
- Ruby Numeric.eql?用法及代碼示例
- Ruby Numeric conjugate()用法及代碼示例
- Ruby Numeric finite?()用法及代碼示例
- Ruby Numeric abs()用法及代碼示例
注:本文由純淨天空篩選整理自ruby-lang.org大神的英文原創作品 Name.subdomain_of?。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。