# xarray.DataArray.str.startswith

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

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('aa3fdaff-8718-4a9b-8e04-6ea0147b6621','6c0ffb97-e449-41d9-b871-c3d4d3e7ce4f','1fd253ab-4088-46f9-8967-4ad99e86311a','../lite/tree/../notebooks/index.html?path=4f2d0232_36b9_49d9_8b0c_e298d751f64f.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="1fd253ab-4088-46f9-8967-4ad99e86311a" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('aa3fdaff-8718-4a9b-8e04-6ea0147b6621','1fd253ab-4088-46f9-8967-4ad99e86311a')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('aa3fdaff-8718-4a9b-8e04-6ea0147b6621','1fd253ab-4088-46f9-8967-4ad99e86311a')">Open In Tab</button></div><div id="6c0ffb97-e449-41d9-b871-c3d4d3e7ce4f" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>
