| 赞 | 72 |
| VIP | |
| 好人卡 | |
| 积分 | 23 |
| 经验 | |
| 最后登录 | 2022-3-9 |
| 在线时间 | 4033 小时 |
…あたしは天
- 梦石
- 0
- 星屑
- 2308
- 在线时间
- 4033 小时
- 注册时间
- 2010-10-4
- 回帖
- 10548
 
|
发表于 2015-8-20 19:23:58
|
显示全部楼层
本帖最后由 taroxd 于 2015-8-20 19:29 编辑
墨凌羽 发表于 2015-8-20 18:44 
想起折腾ruby 差不多有一个月的时间再折腾字符串处理之类的【csv读取、xml读取、括弧匹配什么的 ...
Ruby 真简单,看了楼主的「提示」就坚决不想学 Java 了
[pre lang="ruby"]
Student = Struct.new(:stuNo, :name) do
def equals(others)
self.stuNo == others.stuNo
end
def toString
"姓名:#{name}\t学号:#{stuNo}"
end
end
month, day, year = gets.split('/')
"#{year}年#{month}月#{day}日", year, month, day
"随机字符串".count 'A-z'
"随机字符串".count '0-9'
"一段歌词".scan('朋友').size
"有敏感词的内容".gsub Regexp.union('敏感词', '内容'), ''
[/pre] |
|