Skip to content

replace

Replace a portion of a string at a specific position.

v = replace(old_text, start_num, num_chars, new_text)

Returns old_text with the substring of length num_chars starting at position start_num replaced by new_text. To replace based on the content of a substring rather than position, use substitute or strrep.

replace('hello world', 7, 5, 'there') % 'hello there'
  • substitute — Replace text by content (substring matching).
  • strrep — Replace all occurrences of a substring.