34,333
edits
Changes
no edit summary
== Changing a Section of a String ==
Ruby allows part of a string to be modified thorough through the use of the []= method. To use this method, simply pass through the string of characters to be replaced to the method and assign the new string. As is often the case, this is best explained through the use of an example:
<pre>
== Inserting Text Into a Ruby String ==
So far in this chapter we have looked exclusively at changing the existing text contained in a Ruby string object. Another common requirement is to insert new text at a certain location in a string. This is achieved in Ruby using the ''insert'' method. The insert method takes as arguments index postion position into the string where the insertion is take place, followed by the string to be inserted
<pre>