Symbol#succ():succ()是Symbol类方法,它返回下一个符号对象。
用法:Symbol.succ()
参数:符号值
返回:下一个符号对象
示例1:
# Ruby code for Symbol.succ() 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"
# succ form
puts "Symbol a succ form : #{a.succ}\n\n"
puts "Symbol b succ form : #{b.succ}\n\n"
puts "Symbol c succ form : #{c.succ}\n\n"
输出:
Symbol a : aBcDeF Symbol b : äöü Symbol c : ABCDEF Symbol a succ form : aBcDeG Symbol b succ form : äöý Symbol c succ form : ABCDEG
示例2:
# Ruby code for Symbol.succ() 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"
# succ form
puts "Symbol a succ form : #{a.succ}\n\n"
puts "Symbol b succ form : #{b.succ}\n\n"
puts "Symbol c succ form : #{c.succ}\n\n"
输出:
Symbol a : geeks Symbol b : åöó Symbol c : GEEKS Symbol a succ form : geekt Symbol b succ form : åöô Symbol c succ form : GEEKT
相关用法
- Ruby Time succ()用法及代码示例
- Ruby Integer succ()用法及代码示例
- Ruby Symbol next用法及代码示例
- Ruby Symbol to_proc用法及代码示例
- Ruby Symbol swapcase用法及代码示例
- Ruby Symbol to_sym用法及代码示例
- Ruby Symbol upcase用法及代码示例
- Ruby Symbol slice用法及代码示例
- Ruby Symbol size用法及代码示例
- Ruby Symbol match用法及代码示例
- Ruby Symbol intern用法及代码示例
- Ruby Symbol to_s用法及代码示例
注:本文由纯净天空筛选整理自mayank5326大神的英文原创作品 Ruby | Symbol succ function。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。