# xarray.DataArray.str.slice_replace

#### DataArray.str.slice_replace(start=None, stop=None, repl='')[[source]](https://github.com/pydata/xarray/blob/v2026.09.0/xarray/core/accessor_str.py#L387-L432)

Replace a positional slice of a string with another value.

If start, stop, or ‘repl\` is array-like, they are broadcast
against the array and applied elementwise.

* **Parameters:**
  * **start** ([`int`](https://docs.python.org/3/builtins/functions.html#int) or [array-like](https://numpy.org/doc/stable/glossary.html#term-array_like) of [`int`](https://docs.python.org/3/builtins/functions.html#int), *optional*) – Left index position to use for the slice. If not specified (None),
    the slice is unbounded on the left, i.e. slice from the start
    of the string. If array-like, it is broadcast.
  * **stop** ([`int`](https://docs.python.org/3/builtins/functions.html#int) or [array-like](https://numpy.org/doc/stable/glossary.html#term-array_like) of [`int`](https://docs.python.org/3/builtins/functions.html#int), *optional*) – Right index position to use for the slice. If not specified (None),
    the slice is unbounded on the right, i.e. slice until the
    end of the string. If array-like, it is broadcast.
  * **repl** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str) or [array-like](https://numpy.org/doc/stable/glossary.html#term-array_like) of [`str`](https://docs.python.org/3/builtins/stdtypes.html#str), *default*: `""`) – String for replacement. If not specified, the sliced region
    is replaced with an empty string. If array-like, it is broadcast.
* **Returns:**
  **replaced** (`same type as values`)
