# Как обрезать часть строки

##

{{ substr($Переменная, 0, 3) }}

где: 0 - номер символа с которого начать обрезание строки (важно! нумерация начинается с нуля, т.е. 0 - первый символ, 1 - второй символ, 2 - третий символ и т. д.); 3 - количество сиволов, которое нужно оставить в строке;

Например в переменной $Строка записано значение "abcdef"&#x20;

{{ substr($Строка, 0, 3) }} -> abc&#x20;

{{ substr($Строка, 1, 2) }} -> bc&#x20;

{{ substr($Строка, 3) }} -> def&#x20;

{{ substr($Строка, -1, 1) }} -> f&#x20;

{{ substr($Строка, -2, 1) }} -> e

С помощью этого решения можно, например, вырезать часть номера телефона, если он сохранён в переменной.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.watbot.ru/chat-boty/scenarii-bota/avtopodstanovka/sistemnye-funkcii/kak-obrezat-chast-stroki.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
