# 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('542a0bf3-b7ca-4184-a890-d57df02a523e','ce75d05b-4c16-4ac8-b6b6-f4f7b140e941','5dd24151-ac67-43a9-aeec-d2935aea15f1','../lite/tree/../notebooks/index.html?path=3ec51fb8_af25_4665_a8bb_1369d5634c78.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="5dd24151-ac67-43a9-aeec-d2935aea15f1" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('542a0bf3-b7ca-4184-a890-d57df02a523e','5dd24151-ac67-43a9-aeec-d2935aea15f1')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('542a0bf3-b7ca-4184-a890-d57df02a523e','5dd24151-ac67-43a9-aeec-d2935aea15f1')">Open In Tab</button></div><div id="ce75d05b-4c16-4ac8-b6b6-f4f7b140e941" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>
