[英]Using casecmp in Ruby with Pattern Matching
Is there any way to use casecmp in Ruby in conjunction with pattern matching? 有没有办法在Ruby中将casecmp与模式匹配结合使用? For example, if I want to compare "Ba" with "Alabama", would I be able to do it with casecmp?
例如,如果我想将“ Ba”与“ Alabama”进行比较,是否可以使用casecmp做到这一点?
Thanks so much 非常感谢
Did you mean 你的意思是
"Alabama" =~ /Ba/i #=> 3
? ?
http://www.ruby-doc.org/core-1.9.3/Regexp.html , section Options http://www.ruby-doc.org/core-1.9.3/Regexp.html的“选项”部分
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.