Ruby | Regexp casefold?() function

Regexp#casefold?() : casefold?() is a Regexp class method which returns the value of the case-insensitive flag of regular expressions.

Syntax: Regexp.casefold?()

Parameter: Regexp values



Return: value of the case-insensitive flag of regular expressions

Example #1 :

filter_none

edit
close

play_arrow

link
brightness_4
code

# 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"

chevron_right


Output :

Regexp casefold? form : false

Regexp casefold? form : true

Regexp casefold? form : false

Example #2 :

filter_none

edit
close

play_arrow

link
brightness_4
code

# 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"

chevron_right


Output :

Regexp casefold? form : false

Regexp casefold? form : false

Regexp casefold? form : true




My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.