# xarray.core.accessor_str.StringAccessor.endswith

#### StringAccessor.endswith(pat)[[source]](https://github.com/pydata/xarray/blob/main/xarray/core/accessor_str.py#L1204-L1238)

Test if the end 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:**
  **endswith** ([array](https://numpy.org/doc/stable/glossary.html#term-array) of [`bool`](https://docs.python.org/3/builtins/functions.html#bool)) – A Series of booleans indicating whether the given pattern matches
  the end of each string element.

### Examples

<div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesShowIframe('fee3420b-f74b-499b-b220-3637f31153b5','0e141b8e-907a-439a-820c-bdc3885167f6','04a16dfa-2936-4e1d-baa0-7b1d37e708e2','../lite/tree/../notebooks/index.html?path=9503b9f2_4a36_49b6_a797_b2b63cc314a1.ipynb','None')">Try it in your browser!</button></div>
```pycon
>>> da = xr.DataArray(["10C", "10c", "100F"], dims="x")
>>> da
<xarray.DataArray (x: 3)> Size: 48B
array(['10C', '10c', '100F'], dtype='<U4')
Dimensions without coordinates: x
>>> endswith = da.str.endswith("C")
>>> endswith
<xarray.DataArray (x: 3)> Size: 3B
array([ True, False, False])
Dimensions without coordinates: x
```

<div id="04a16dfa-2936-4e1d-baa0-7b1d37e708e2" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('fee3420b-f74b-499b-b220-3637f31153b5','04a16dfa-2936-4e1d-baa0-7b1d37e708e2')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('fee3420b-f74b-499b-b220-3637f31153b5','04a16dfa-2936-4e1d-baa0-7b1d37e708e2')">Open In Tab</button></div><div id="0e141b8e-907a-439a-820c-bdc3885167f6" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>
