Ruby | Symbol length function Last Updated : 10 Dec, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report Symbol#length() : length() is a Symbol class method which returns the length of the symbol. Syntax: Symbol.length() Parameter: Symbol values Return: the length of the symbol Example #1 : Ruby # Ruby code for Symbol.length() method # declaring Symbol a = :aBcDeF # declaring Symbol b = :"\u{e4 f6 fc}" # declaring Symbol c = :ABCDEF # Symbol puts "Symbol a : #{a}\n\n" puts "Symbol b : #{b}\n\n" puts "Symbol c : #{c}\n\n\n\n" # length form puts "Symbol a length form : #{a.length}\n\n" puts "Symbol b length form : #{b.length}\n\n" puts "Symbol c length form : #{c.length}\n\n" Output : Symbol a : aBcDeF Symbol b : äöü Symbol c : ABCDEF Symbol a length form : 6 Symbol b length form : 3 Symbol c length form : 6 Example #2 : Ruby # Ruby code for Symbol.length() method # declaring Symbol a = :geeks # declaring Symbol b = :"\u{e5 f6 f3}" # declaring Symbol c = :GEEKS # Symbol puts "Symbol a : #{a}\n\n" puts "Symbol b : #{b}\n\n" puts "Symbol c : #{c}\n\n\n\n" # length form puts "Symbol a length form : #{a.length}\n\n" puts "Symbol b length form : #{b.length}\n\n" puts "Symbol c length form : #{c.length}\n\n" Output : Symbol a : geeks Symbol b : åöó Symbol c : GEEKS Symbol a length form : 5 Symbol b length form : 3 Symbol c length form : 5 Comment More infoAdvertise with us Next Article Ruby | Symbol length function M mayank5326 Follow Improve Article Tags : Ruby Ruby-Methods Ruby Symbol-class Similar Reads Ruby | Symbol next function Symbol#next() : next() is a Symbol class method which returns the next symbol object. Syntax: Symbol.next() Parameter: Symbol values Return: the next symbol object. Example #1 : Ruby # Ruby code for Symbol.next() method # declaring Symbol a = :aBcDeF # declaring Symbol b = :"\u{e4 f6 fc}" 2 min read Ruby | Symbol match function Symbol#match() : match() is a Symbol class method which matches the pattern with symbol. Syntax: Symbol.match() Parameter: Symbol values Return: position - if pattern matches the Symbol otherwise return nil Example #1 : Ruby # Ruby code for Symbol.match() method # declaring Symbol a = :aBcDeF # decl 2 min read Ruby | Set length() function The length() is an inbuilt method in Ruby returns the size of the Set. It returns the number of elements in the set. Syntax: s1_name.length() Parameters: The function does not accepts any parameter. Return Value: It returns the size of the set. Example 1: Ruby # Ruby program to illustrate # the leng 1 min read Ruby | Symbol =~ function 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 : Ruby # Ruby code for Symbol.=~() method # declaring Symbol a = :aBcDeF # declaring Symbol b = : 2 min read Ruby | Symbol == function Symbol#==() : ==() is a Symbol class method which compares two Symbol objects. Syntax: Symbol.==() Parameter: Symbol values Return: true if two Symbols are equal otherwise return false Example #1 : Ruby # Ruby code for Symbol.==() method # declaring Symbol a = :aBcDeF # declaring Symbol b = :"\ 2 min read Like