Regexp#casefold?():casefold?()是一个Regexp类方法,它返回正则表达式的不区分大小写标志的值。
用法:Regexp.casefold?()
参数:正则表达式值
返回:正则表达式的不区分大小写标志的值
范例1:
# Ruby code for Regexp.casefold?() method
# declaring Regexp value
reg_a = /a/
# declaring Regexp value
reg_b = /geeks/i
# declaring Regexp value
reg_c = /a/
# casefold? method
puts "Regexp casefold? form:#{reg_a.casefold?}\n\n"
puts "Regexp casefold? form:#{reg_b.casefold?}\n\n"
puts "Regexp casefold? form:#{reg_c.casefold?}\n\n"
输出:
Regexp casefold? form:false Regexp casefold? form:true Regexp casefold? form:false
范例2:
# Ruby code for Regexp.casefold?() method
# declaring Regexp value
reg_a = /geeks/
# declaring Regexp value
reg_b = /problem/
# declaring Regexp value
reg_c = /code/i
# casefold? method
puts "Regexp casefold? form:#{reg_a.casefold?}\n\n"
puts "Regexp casefold? form:#{reg_b.casefold?}\n\n"
puts "Regexp casefold? form:#{reg_c.casefold?}\n\n"
输出:
Regexp casefold? form:false Regexp casefold? form:false Regexp casefold? form:true
相关用法
- Ruby Regexp eql?()用法及代码示例
- Ruby Regexp new()用法及代码示例
- Scala Regexp ===()用法及代码示例
- Scala Regexp ==()用法及代码示例
- Scala Regexp =~()用法及代码示例
- Ruby Regexp named_captures()用法及代码示例
- Ruby Regexp options()用法及代码示例
- Ruby Regexp escape()用法及代码示例
- Ruby Regexp inspect()用法及代码示例
- Ruby Regexp hash()用法及代码示例
- Ruby Regexp match()用法及代码示例
- Ruby Regexp names()用法及代码示例
- Ruby Regexp quote()用法及代码示例
- Ruby Regexp source()用法及代码示例
- Ruby Regexp to_s()用法及代码示例
注:本文由纯净天空筛选整理自mayank5326大神的英文原创作品 Ruby | Regexp casefold?() function。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。