> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.itential.com/itential-platform/2023-2/studio/tasks/reference/ends-with/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.itential.com/_mcp/server. # endsWith > Use the endsWith task to determine whether a string ends with a specified sequence of characters. The `endsWith` task searches a given string to determine whether a specified sequence of characters appears at the end. You can also limit the number of characters searched. The task returns `true` if the string ends with the characters, or `false` if they are not found. The original string is not changed. To check whether a string begins with a specified sequence instead, use the `startsWith` task. ## Potential use case Use `endsWith` to check whether a filename ends with a certain extension. For example, to check whether `filename.txt` ends with `.txt`, run `endsWith` against your file list. A `true` result confirms the extension is present; a `false` result confirms it is not. You can also use the `length` parameter to limit the search to only the beginning portion of the list. ## Properties | Incoming | Type | Description | | :------------- | :----- | :--------------------------------------------------------------------------- | | `str` | String | Required. The string to search. | | `searchString` | String | Required. The characters to search for at the end of the string. | | `length` | Number | The length of the string to search. If omitted, the full string is searched. | | Outgoing | Type | Description | | :------- | :------ | :--------------------------------------------------------------- | | `result` | Boolean | `true` if `searchString` is found at the end; `false` otherwise. | ## Example 1 In this example: * `str` is `"Hello world, welcome to the universe."` * `searchString` is `"universe."` * `length` is not specified, so the entire string is searched. * The expected `result` is `true`. ![](/_fern-img/b275190536c3cab3eb408aca4bdcdf0b490c7e33e445941f91ea798d0752817a.webp) ## Example 2 In this example: * `str` is the same as example one. * `searchString` is `"world"`. * `length` is specified — only the first 11 characters of the string are searched. * The expected `result` is `true`, because `"world"` is found at the end of the first 11 characters. ![](/_fern-img/f36a0c47423c774ccab662312cceba8f18557726889d8afc48f9e05cf2a405b4.webp) > Use the endsWith task to determine whether a string ends with a specified sequence of characters.