---
category: [Administration & Integrations, Platform and Product Extensions, Platform and Product Extensions/Integration, Administration & Integrations/Custom Integrations & Apps, Platform and Product Extensions/Workday Extend]
keyword: [Extend, PMD Scripting, Scripts]
nav: wcp_docs
parent_url: /wcp_docs/
title: substring (startIndex, endIndex)
layout: subsection
---

## <a id="section_m3p_myb_5db"></a>Description

Returns a substring from the specified start position to the specified end position of the string.

## <a id="section_cyq_j1m_zsb"></a>Return Type

`String`

## <a id="section_dz5_pwg_5db"></a>Instance Method Syntax

```
thisString.substring(startIndex, endIndex)
```

<table><thead><tr><th>Parameter</th><th>Description</th></tr></thead><tbody><tr><td>startIndex</td><td>The zero-based starting position within the given string.</td></tr><tr><td>endIndex</td><td>The substring ends at <code>endIndex - 1</code>.</td></tr></tbody></table><br/>

<b>Example</b>

`'The quick brown fox'.substring(4, 9)`

Returns `'quick'`

## <a id="section_dz5_pwg_5d"></a>Namespace Function Syntax

```
string:substring(string, startIndex, endIndex)
```

<table><thead><tr><th>Parameter</th><th>Description</th></tr></thead><tbody><tr><td>string</td><td>A string.</td></tr><tr><td>startIndex</td><td>The zero-based starting position within the given string.</td></tr><tr><td>endIndex</td><td>The substring ends at <code>endIndex - 1</code>.</td></tr></tbody></table><br/>

`string:substring('Hello World!', 2, 5)`

Returns `llo`

