道喜技术日记 .^. 天天红玉世界

Rails Ruby MacOSX 。。。创新来自于刻苦的实践和勤奋的思考... www.hhtong.com


Ruby语言:连加或者连乘函数

Gudao Luo2012-04-19 at 08:19发表的

标记: Codes, Ruby, fact, function, inject

Ruby语言:使用函数first

Gudao Luo2011-03-22 at 15:59发表的

  • 说明
    • 在Ruby语言中,类Array有函数first,而类String没有函数first。因此,"standard".first(2)中的"standard"被看作为类Array对象,即[“standard”]。
    • 在Rails框架中,"standard"被看作为字符串String的对象。
标记: Ruby, first, function