summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-string-ext/mrblib
diff options
context:
space:
mode:
Diffstat (limited to 'mrbgems/mruby-string-ext/mrblib')
-rw-r--r--mrbgems/mruby-string-ext/mrblib/string.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/mrbgems/mruby-string-ext/mrblib/string.rb b/mrbgems/mruby-string-ext/mrblib/string.rb
index e6fbe7ddc..6e5f3c73d 100644
--- a/mrbgems/mruby-string-ext/mrblib/string.rb
+++ b/mrbgems/mruby-string-ext/mrblib/string.rb
@@ -385,4 +385,18 @@ class String
end
end
alias each_codepoint codepoints
+
+ ##
+ # call-seq:
+ # str.prepend(other_str) -> str
+ #
+ # Prepend---Prepend the given string to <i>str</i>.
+ #
+ # a = "world"
+ # a.prepend("hello ") #=> "hello world"
+ # a #=> "hello world"
+ def prepend(arg)
+ self[0, 0] = arg
+ self
+ end
end