mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
mruby-string-ext: forgot to remove Ruby version of partition, rpartition
This commit is contained in:
@@ -1,29 +1,5 @@
|
||||
class String
|
||||
|
||||
def partition(sep)
|
||||
raise TypeError, "type mismatch: #{sep.class} given" unless sep.is_a? String
|
||||
n = index(sep)
|
||||
unless n.nil?
|
||||
m = n + sep.size
|
||||
[ slice(0, n), sep, slice(m, size - m) ]
|
||||
else
|
||||
[ self[0..-1], "", "" ]
|
||||
end
|
||||
end
|
||||
|
||||
def rpartition(sep)
|
||||
raise TypeError, "type mismatch: #{sep.class} given" unless sep.is_a? String
|
||||
n = rindex(sep)
|
||||
unless n.nil?
|
||||
m = n + sep.size
|
||||
[ slice(0, n), sep, slice(m, size - m) ]
|
||||
else
|
||||
[ "", "", self ]
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
##
|
||||
# call-seq:
|
||||
# str.insert(index, other_str) -> str
|
||||
|
||||
Reference in New Issue
Block a user