Related Articles

Related Articles

Ruby | Regexp casefold?() function
  • Last Updated : 17 Dec, 2019

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
Recommended Articles
Page :