VOOZH about

URL: https://www.geeksforgeeks.org/ruby/ruby-symbol-function-3/

⇱ Ruby | Symbol =~ function - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Ruby | Symbol =~ function

Last Updated : 9 Dec, 2019
Symbol#=~() : =~() is a Symbol class method which =~es the pattern with symbol.
Syntax: Symbol.=~() Parameter: Symbol values Return: position - if pattern =~es the Symbol otherwise return nil
Example #1 : Output :
Symbol a : aBcDeF

Symbol b : äöü

Symbol c : ABCDEF



Symbol a =~ form : 3

Symbol b =~ form : 

Symbol c =~ form : 2

Example #2 : Output :
Symbol a : geeks

Symbol b : åöó

Symbol c : GEEKS



Symbol a =~ form : 0

Symbol b =~ form : 

Symbol c =~ form : 1
Comment
Article Tags: