BSON_DECIMAL12...OM_STRING_W_LEN(3)

πŸ’… bson_decimal128_from_string_w_len(3) πŸ’…

okay bestie, you're looking at the libbson manual page for bson_decimal128_from_string_w_len(3) β€” yes, the name is a whole mouthful, but it's literally iconic for turning a string into a Decimal128. ✨

✨ SYNOPSIS ✨

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

πŸŽ€ PARAMETERS πŸŽ€

  • string β€” A string containing ASCII encoded Decimal128. πŸ’–
  • len β€” The length of string in bytes, or -1 meaning the string is null-terminated. 🫢
  • 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. No cap, that spec is where the exact string-format tea lives. πŸ“

🌸 RETURNS 🌸

Returns true if valid Decimal128 string was provided, otherwise false and dec will be set to NaN. 😭 That's the whole vibe check: valid string = true; invalid = false plus dec chilling as 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 πŸ‘‘

2009-present, MongoDB, Inc.


mwah πŸ’‹ β€” this page is from libbson version 2.5.6, dated Oct 09, 20. byeeee 🫢✨

πŸ“¦ where this page comes from