Sha256: 689c109a2d9d8541ef75946e6740a2944276c6d40ed158df736e34ad1a03dfc9

Contents?: true

Size: 255 Bytes

Versions: 2

Compression:

Stored size: 255 Bytes

Contents

class String
  def naive_split(pattern)
    string = self.dup
    found = []

    while position = string.index(pattern)
      found << string.slice!(0, position)
      string.slice!(0,[pattern.size,1].max)
    end

    found << string
    found
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ruco-0.0.2 lib/ruco/core_ext/string.rb
ruco-0.0.1 lib/ruco/core_ext/string.rb