# Strings cut

The **Strings cut** step returns a snippet of an input string based on a range of character locations.

For example, you may need to parse the time `11:00` out of a file name such as `11:00 am update` by returning the substring starting at index `0` and ending before index `5`.

{% hint style="info" %}
If you specify locations outside the length of the input string, Strings cut returns an empty string.
{% endhint %}

### Step name

* **Step name**: Specify the unique name of the Strings cut step on the canvas. You can customize the name or leave it as the default.

### Fields to cut

Use the **Fields to cut** table to specify what to cut and where to cut it.

| Column               | Description                                                                                                                            |
| -------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| **In stream field**  | Name of the field containing the string to cut. Select **Get fields** to populate the table from the incoming stream.                  |
| **Out stream field** | (Optional) A new output field containing the substring result. If you do not specify a value, the step replaces **In stream field**.   |
| **Cut from**         | Starting character location (zero-based). The first character has index `0`.                                                           |
| **Cut to**           | Character location after the ending point (zero-based, exclusive). For example, setting **Cut to** to `1` returns the first character. |

The maximum length of the resulting string is **Cut to** minus **Cut from**.

### Example

Given the string `example`, the character indexes are:

| Character | e | x | a | m | p | l | e |
| --------- | - | - | - | - | - | - | - |
| Index     | 0 | 1 | 2 | 3 | 4 | 5 | 6 |

To return the first letter `e`, set **Cut from** to `0` and **Cut to** to `1`.

To return `am`, set **Cut from** to `2` and **Cut to** to `4`.

### Metadata injection support

This step supports metadata injection. You can use it with [ETL metadata injection](https://docs.pentaho.com/pdia-data-integration/pdi-transformation-steps-reference-overview/etl-metadata-injection) to pass metadata to your transformation at runtime.
