浙江省高等学校教师教育理论培训

微信搜索“毛凌志岗前心得”小程序

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
        if num=~ /\d+/
          buy_num=num.to_i
        else
          buy_num=1
        end

1
down voteaccept

You forgot to include the class you were testing against:

"1".is_a?(Integer) # false
1.is_a?(Integer) # true

posted on 2010-11-26 11:39  lexus  阅读(165)  评论(0编辑  收藏  举报