---
name: "bson_decimal128_from_string"
section: "3"
platform: "linux"
package: "libbson-doc"
version: "1.30.4-1+deb13u3"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/bson_decimal128_from_string"
---

# bson\_decimal128\_from\_string(3)

## SYNOPSIS

```
bool
bson_decimal128_from_string (const char *string, bson_decimal128_t *dec);
```

## PARAMETERS

- •

  **string**: A string containing ASCII encoded Decimal128.

- •

  **dec**: A *bson\_decimal128\_t*.

## DESCRIPTION

Parses the string containing ascii encoded Decimal128 and initialize the bytes in **dec**. See the *Decimal128 specification* for the exact string format.

## RETURNS

Returns **true** if valid Decimal128 string was provided, otherwise **false** and **dec** will be set to **NaN**.

## EXAMPLE

```
bson_decimal128_t dec;
bson_decimal128_from_string ("1.00", &dec);
```

## AUTHOR

MongoDB, Inc

## COPYRIGHT

2009-present, MongoDB, Inc.
