rb_str_modify() equivalent in the Ruby language

Posted by Hagbard on Stack Overflow See other posts from Stack Overflow or by Hagbard
Published on 2010-03-15T15:10:28Z Indexed on 2010/03/15 15:59 UTC
Read the original article Hit count: 102

Filed under:
|

I was trying to add a method to the String class. This method should mutate the current string (of course it would be possible to write a not mutating version but I'd prefer the mutating one). I had no idea how to do this and after some googling I found the method rb_str_modify which makes a given string mutable. That's exactly what I need but I couldn't find an equivalent in the Ruby language. Did I miss something or is there really no possibility in the language itself?

© Stack Overflow or respective owner

Related posts about ruby

Related posts about string-manipulation