# Сумма чисел в строке (sum\_numbers\_in\_string)

## sum\_numbers\_in\_string

Функция ищет в тексте все числа, приводит их к числовому виду и возвращает **их сумму**.

Она использует тот же принцип извлечения чисел, что и функция [str\_extract\_numbers](/funkcii/izvlechenie-chisel-iz-stroki-str_extract_numbers.md), но вместо массива чисел возвращает одно итоговое значение.

**Пример:**

Вход:

```
[sum_numbers_in_string]asdsad12 3 sjd5wef 0 ----2 5.45[/sum_numbers_in_string]
```

Результат:\
`18.45`\
(так как 12 + 3 + 0 + (-2) + 5.45 = 18.45)

Формат записи следующий:

`[sum_numbers_in_string]текст[/sum_numbers_in_string]`

#### Аргументы

Функция принимает **1 аргумент**:

1. **Текст (обязательный)**\
   Строка, в которой нужно найти все числа и посчитать их сумму.

#### Особенности работы

* Если в строке **нет ни одного числа**, результатом будет `0`.

Если возникли вопросы или трудности - смело обращайся в техподдержку. \
Рады каждому, поможем с любым вопросом и решим любую проблему 🤗

{% content-ref url="/pages/-MasAPNcg291uNezFqb4" %}
[Как задать вопрос в поддержку?](/kak-zadat-vopros-v-podderzhku.md)
{% endcontent-ref %}


---

# 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://docs.leadconverter.su/funkcii/summa-chisel-v-stroke-sum_numbers_in_string.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.
