2013-04-10 21:29:02 -07:00
|
|
|
text = 'a!===b=!=c'
|
|
|
|
|
separators = ['==', '!=', '=']
|
|
|
|
|
|
|
|
|
|
def multisplit_simple(text, separators)
|
2015-02-20 00:35:01 -05:00
|
|
|
text.split(Regexp.union(separators))
|
2013-04-10 21:29:02 -07:00
|
|
|
end
|
|
|
|
|
|
2015-02-20 00:35:01 -05:00
|
|
|
p multisplit_simple(text, separators) # => ["a", "", "b", "", "c"]
|