---
title: "substring · RUAL Documentation"
description: "RUAL value block."
canonical: https://docs.rual.nl/block-types/value/value_substr
language: en
---

# substring

This block is part of the [`value`](https://docs.rual.nl/block-types/value) group and was last modified in core [`v10.4.28`](https://docs.rual.nl/core-versions/100428).

- value required `value`

- index `number` Default `0`

- length required `number`

- Output `value`

Extracts number_1 characters starting at index number_0, counting Unicode code points. A falsy input (nil, "", or the number 0) emits NO output at all (the out-pin stays unset). A NEGATIVE start is clamped to 0 -- it does NOT count from the end like JS substr; a start past the end outputs "", and a missing or non-numeric length takes the rest of the string. Non-string input is coerced to its JS string form first.

| `substr` |
| --- |

A typical wiring for [substring](https://docs.rual.nl/block-types/value/value_substr): [number](https://docs.rual.nl/block-types/number/number_default) feeds the `number_0` pin; [random between](https://docs.rual.nl/block-types/number/number_random_between) feeds the `value` pin; the `value` out pin feeds [concatenate values](https://docs.rual.nl/block-types/value/value_concatenate).

![Studio canvas example for the substring block: typical wiring for substring.](https://docs.rual.nl/canvas-examples/value_substr.png)

### Commonly used with

In production blueprints, this block is most often wired together with:

- [number](https://docs.rual.nl/block-types/number/number_default): feeds into this block. Generates a valid number from the filled custom value in the blueprint.

- [concatenate values](https://docs.rual.nl/block-types/value/value_concatenate): this block feeds into it.

- [set fields](https://docs.rual.nl/block-types/mutations/mutations_set_bp_field_multiple): this block feeds into it. Generates an array of mutations based on the given filled fields.

- [random between](https://docs.rual.nl/block-types/number/number_random_between): feeds into this block. Generates a random number between, including, the given two numbers. This number will be an integer (e.g. 1, 2, 3) without decimals.

- [value](https://docs.rual.nl/block-types/value/value_default): feeds into this block. Simply returns the provided value.

- [get fields](https://docs.rual.nl/block-types/object/object_field_getter_multiple): feeds into this block. Gets the selected fields from the given object.

### Version history

Introduced in [`v10.4.28`](https://docs.rual.nl/core-versions/100428).
