Index: src/org/jruby/RubyString.java
===================================================================
RCS file: /cvsroot/jruby/jruby/src/org/jruby/RubyString.java,v
retrieving revision 1.43
diff -b -u -r1.43 RubyString.java
--- src/org/jruby/RubyString.java	26 Mar 2006 21:21:40 -0000	1.43
+++ src/org/jruby/RubyString.java	6 Apr 2006 00:56:19 -0000
@@ -229,6 +229,29 @@
 		return this;
 	}
 
+    /** rb_str_insert
+     *
+     */
+    public RubyString insert(IRubyObject index, IRubyObject other) {
+        RubyString str = stringValue(other);
+        StringBuffer sb = new StringBuffer(getValue());
+        long idx = index.convertToInteger().getLongValue();
+
+        if (idx < 0) {
+            idx = sb.length() + 1 + idx;
+        }
+        if (idx > sb.length()) {
+            idx = sb.length();
+        }
+        if (idx < 0) {
+            idx = 0;
+        }
+
+        sb.insert((int) idx, str.getValue());
+        setValue(sb.toString());
+        return (RubyString) infectBy(this);
+    }
+
 	/** rb_str_replace_m
 	 *
 	 */
Index: src/org/jruby/runtime/builtin/meta/StringMetaClass.java
===================================================================
RCS file: /cvsroot/jruby/jruby/src/org/jruby/runtime/builtin/meta/StringMetaClass.java,v
retrieving revision 1.11
diff -b -u -r1.11 StringMetaClass.java
--- src/org/jruby/runtime/builtin/meta/StringMetaClass.java	10 Feb 2006 21:53:25 -0000	1.11
+++ src/org/jruby/runtime/builtin/meta/StringMetaClass.java	6 Apr 2006 00:56:20 -0000
@@ -191,6 +191,7 @@
 	        defineMethod("index", Arity.optional());
 	        defineMethod("initialize", Arity.optional(), "initialize");
 	        defineMethod("initialize_copy", Arity.singleArgument(), "replace");
+            defineMethod("insert", Arity.twoArguments());
 	        defineMethod("inspect", Arity.noArguments());
 	        defineMethod("length", Arity.noArguments());
 	        defineMethod("ljust", Arity.singleArgument());
Index: test/testString.rb
===================================================================
RCS file: /cvsroot/jruby/jruby/test/testString.rb,v
retrieving revision 1.18
diff -b -u -r1.18 testString.rb
--- test/testString.rb	26 Mar 2006 21:21:40 -0000	1.18
+++ test/testString.rb	6 Apr 2006 00:56:20 -0000
@@ -86,3 +86,10 @@
 # oct should return zero in appropriate cases
 test_equal(0, "b".oct)
 test_equal(0, "".oct)
+
+test_equal("Xabcd", "abcd".insert(0, 'X'))
+test_equal("abcXd", "abcd".insert(3, 'X'))
+test_equal("abcdX", "abcd".insert(4, 'X'))
+test_equal("abXcd", "abcd".insert(-3, 'X'))
+test_equal("abcdX", "abcd".insert(-1, 'X'))
+
