BSON_DECIMAL128_FROM_STRING(3)

✨ BSON_DECIMAL128_FROM_STRING(3) ✨

okay so bestie, welcome to the libbson manual page for BSON_DECIMAL128_FROM_STRING(3) πŸ’– this one is literally about turning a string into a Decimal128, and it’s giving parser main-character energy fr fr.


✨ SYNOPSIS ✨

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

🌸 PARAMETERS 🌸

  • string β€” a string containing ASCII encoded Decimal128, bestie. That’s the input vibe.
  • dec β€” a bson_decimal128_t. This is the little container that gets the parsed result.

πŸ¦‹ DESCRIPTION πŸ¦‹

So this function parses the string containing ascii encoded Decimal128 and initializes the bytes in dec 😌✨. For the exact string format, check the Decimal128 specification β€” that’s the authority, no cap.

πŸ’… RETURNS πŸ’…

It returns true if a valid Decimal128 string was provided. Otherwise it returns false, and dec will be set to NaN 😭.

iykyk: invalid string means false plus dec becomes NaN. That’s the whole vibe check.

πŸŽ€ EXAMPLE πŸŽ€

not me being obsessed with this tiny example:

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

πŸ‘‘ AUTHOR πŸ‘‘

MongoDB, Inc

2009-present, MongoDB, Inc.


mwah πŸ’‹ β€” this iconic little page comes from libbson version 2.5.6, dated Oct 09, 2026. bye bestie, slay your Decimal128s πŸ«ΆπŸŽ€

πŸ“¦ where this page comes from