简体   繁体   中英

Using casecmp in Ruby with Pattern Matching

Is there any way to use casecmp in Ruby in conjunction with pattern matching? For example, if I want to compare "Ba" with "Alabama", would I be able to do it with casecmp?

Thanks so much

Did you mean

"Alabama" =~ /Ba/i #=> 3

?

http://www.ruby-doc.org/core-1.9.3/Regexp.html , section Options

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM