FUNCTION REFERENCE

strrep

Replace text.

Replace text.

Syntax

s = strrep(s, old, new)

Syntax

c = strrep(c, old, new)

Replaces every occurrence of old by new. A cell array input gives a cell array. An empty old leaves the text unchanged.

Example

strrep('hello world', 'o', '0')   % 'hell0 w0rld'

Differences from MATLAB: none known.

String inputs are supported with bounded two-dimensional storage.

Example

strrep(["ab" "ac"],"a","z")

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.