bson_decimal128_from_string_w_len - Man Page

Synopsis

bool
bson_decimal128_from_string_w_len (const char *string,
                                   int len,
                                   bson_decimal128_t *dec);

Parameters

Description

Parses the string containing ascii encoded Decimal128 and initialize the bytes in dec. See the Decimal128 specification <https://github.com/mongodb/specifications/blob/master/source/bson-decimal128/decimal128.md> 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_w_len ("1.00", 4, &dec);
bson_decimal128_from_string_w_len ("1.00", -1, &dec);

Author

MongoDB, Inc

Info

Feb 04, 2026 1.30.7 libbson