红宝石 |符号小写值
Symbol#downcase() : downcase()是一个符号类方法,它根据下一个大写形式的位置返回符号的小写形式。
Syntax: Symbol.downcase()
Parameter: Symbol values
Return: the downcased form of symbol based on the position of next capital form.
示例 #1:
# Ruby code for Symbol.downcase() 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"
# downcase form
puts "Symbol a downcase form : #{a.downcase}\n\n"
puts "Symbol b downcase form : #{b.downcase}\n\n"
puts "Symbol c downcase form : #{c.downcase}\n\n"
输出 :
Symbol a : aBcDeF
Symbol b : äöü
Symbol c : ABCDEF
Symbol a downcase form : abcdef
Symbol b downcase form : äöü
Symbol c downcase form : abcdef
示例 #2:
# Ruby code for Symbol.downcase() 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"
# downcase form
puts "Symbol a downcase form : #{a.downcase}\n\n"
puts "Symbol b downcase form : #{b.downcase}\n\n"
puts "Symbol c downcase form : #{c.downcase}\n\n"
输出 :
Symbol a : geeks
Symbol b : åöó
Symbol c : GEEKS
Symbol a downcase form : geeks
Symbol b downcase form : åöó
Symbol c downcase form : geeks