# Сумма цифр в строке (sum\_digits\_in\_string)

## sum\_digits\_in\_string

Функция ищет в тексте **все отдельные цифры** и возвращает сумму этих цифр.

В отличие от [sum\_numbers\_in\_string](/funkcii/summa-chisel-v-stroke-sum_numbers_in_string.md), где ищутся **целые и дробные числа целиком**, здесь каждая цифра (`0–9`) учитывается отдельно.

**Пример использования:**

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

Результат:\
22 (так как 1 + 2 + 3 + 0 + 2 + 5 + 4 + 5 = 22)

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

Функция принимает **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-cifr-v-stroke-sum_digits_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.
