---
title: subString()
slug: substring
createdAt: 2021-09-14T17:49:55.000Z
---

Given a `String` and specified parameters, returns a part of that `String`.

### Syntax

`subString(string, start[, length])`

- `string` - the `String` value from which to derive the returned `String`
- `start` - the starting index of the returned `String`
- `length` - (optional) the length of the returned `String`
- **Return type:** [String](docId\:Ujw2AQAktel5uukLuP73S)&#x20;

### Sample usage

`subString("Piece of cake.", 2)` returns `"ece of cake."`

`subString("Piece of cake.", 2, 3)` returns `"ece"`

### Supported data types

| **Input type**                              | **Return type**                         | **Logic**                                                                                                                                                                                                                                                                                                 |
| ------------------------------------------- | --------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ****[String](docId\:Ujw2AQAktel5uukLuP73S)  | [String](docId\:Ujw2AQAktel5uukLuP73S)  | If a String value is passed, that value will be interpreted beginning with the `start` index. If a `length` is provided, the returned String will contain that many characters, beginning with the `index`. If not, the returned String will contain all remaining characters beginning with the `index`. |
| *Unsupported data types*                    | **[Null](docId\:N9trVqonnBknqL9DrNBP6)  | Unsupported data types return `Null`.                                                                                                                                                                                                                                                                     |

