add String#strip_prefix

This commit is contained in:
Xu Cheng 2015-12-02 14:23:36 +08:00
parent 18a743c470
commit 9755662e49

View File

@ -21,6 +21,10 @@ class String
s = chomp
s unless s.empty?
end
def strip_prefix(prefix)
start_with?(prefix) ? self[prefix.length..-1] : self
end
end
class NilClass