# xarray.DataArray.str.startswith

#### DataArray.str.startswith(pat)[[source]](https://github.com/pydata/xarray/blob/main/xarray/core/accessor_str.py#L1187-L1222)

Test if the start of each string in the array matches a pattern.

The pattern pat can either be a `str` or array-like of `str`.
If array-like, it will be broadcast and applied elementwise.

* **Parameters:**
  **pat** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Character sequence. Regular expressions are not accepted.
  If array-like, it is broadcast.
* **Returns:**
  **startswith** ([array](https://numpy.org/doc/stable/glossary.html#term-array) of [`bool`](https://docs.python.org/3/builtins/functions.html#bool)) – An array of booleans indicating whether the given pattern matches
  the start of each string element.

### Examples

<div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesShowIframe('03332fd3-a4c0-41da-bac5-388f9098f39d','1a12fd6a-e120-4885-bd3b-b2665e9a7c28','2dc2be4a-8685-4133-9153-19a1e6c3bf32','../lite/tree/../notebooks/index.html?path=6a83f2b1_1ed8_433b_92da_1ce13068b2d0.ipynb','None')">Try it in your browser!</button></div>
```pycon
>>> da = xr.DataArray(["$100", "£23", "100"], dims="x")
>>> da
<xarray.DataArray (x: 3)> Size: 48B
array(['$100', '£23', '100'], dtype='<U4')
Dimensions without coordinates: x
>>> startswith = da.str.startswith("$")
>>> startswith
<xarray.DataArray (x: 3)> Size: 3B
array([ True, False, False])
Dimensions without coordinates: x
```

<div id="2dc2be4a-8685-4133-9153-19a1e6c3bf32" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('03332fd3-a4c0-41da-bac5-388f9098f39d','2dc2be4a-8685-4133-9153-19a1e6c3bf32')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('03332fd3-a4c0-41da-bac5-388f9098f39d','2dc2be4a-8685-4133-9153-19a1e6c3bf32')">Open In Tab</button></div><div id="1a12fd6a-e120-4885-bd3b-b2665e9a7c28" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>
