string replace

string replace string first last ?newstring?

Removes a range of consecutive characters from string, starting with the character whose index is first and ending with the character whose index is last. An index of 0 refers to the first character of the string. First and last may be specified as for the index method. If newstring is specified, then it is placed in the removed character range. If first is less than zero then it is treated as if it were zero, and if last is greater than or equal to the length of the string then it is treated as if it were 'end. If first is greater than last or the length of the initial string, or last is less than 0, then the initial string is returned untouched.


See also:


Examples:

 % string replace "this is a bad example" 10 12 good
 this is a good example

 % string map {bad good} "this is a bad example"
 this is a good example