Hi all,
The function:
static VALUE rb_str_insert(VALUE, VALUE, VALUE)
is defined in string.c but is static and so is not avalible to me to
call
directly on my string. I have a feeling rb_funcall is my answer but I
can’t
find any decent documentation on getting the functions ID.
Can anyone help?
Cheers,
Phil
Phil J. wrote:
Can anyone help?
Cheers,
Phil
Offhand I think this will work:
id_insert = rb_intern(“insert”); // you can do this once
rb_funcall(str, id_insert, 2, idx, str2);
On Wed, May 24, 2006 at 07:37:21 +0900, Joel VanderWerf wrote:
id_insert = rb_intern(“insert”); // you can do this once
rb_funcall(str, id_insert, 2, idx, str2);
You were spot-on, the mistake I was making was:
ID id = rb_intern(“insert”);
rb_funcall(cur_str, id, 3, cur_str, idx, str2);
Which I guess would be the Ruby equivilent of:
str.insert(str, 1, “hello world”)
Thanks,
Phil
Hi,
At Wed, 24 May 2006 07:27:21 +0900,
Phil J. wrote in [ruby-talk:194275]:
The function:
static VALUE rb_str_insert(VALUE, VALUE, VALUE)
is defined in string.c but is static and so is not avalible to me to call
directly on my string. I have a feeling rb_funcall is my answer but I can’t
find any decent documentation on getting the functions ID.
If you are responsible to the arguments, rb_str_update() might
be an answer.