Ruby Alternative join and split in Ruby

huacnlee · 2012年06月29日 · 最后由 fsword 回复于 2012年07月02日 · 1891 次阅读
class String
  alias / :split
end
>> "tic-tac-toe" / "-" 
=> ["tic", "tac", "toe"]

http://rors.org/2008/07/09/alternative-join-and-split-in-ruby

这个设计很欢乐

需要 登录 后方可回复, 如果你还没有账号请 注册新账号