@fn static UnicodeChar* Unicode::snprintfFloat(UnicodeChar* dst, uint16_t dstSize, const char* format, const float value) Variant of snprintf. Variant of snprintf for one float only. The number format supports only one \%f with flags/modifiers. The following is supported: %[flags][width][.precision]f Where flags can be:
'-': left justify the field (see width).
'+': force sign.
' ': insert space if value is positive.
'\#': insert decimal point even if there are not decimals.
'0': left pad with zeros instead of spaces (see width).
Where width is the desired width of the output. If the value is larger, more characters may be generated, but not more than the parameter dstSize. Where precision is the number of number of digits after the decimal point, default is 3. Use "%.f" to not generate any numbers after the decimal point. \code{.cpp} Unicode::UnicodeChar buffer[20]; Unicode::snprintfFloat(buffer, 20, "%6.4f", 3.14159f); // buffer="3.1416" Unicode::snprintfFloat(buffer, 20, "%#6.f", 3.14159f); // buffer=" 3." Unicode::snprintfFloat(buffer, 20, "%6f", 3.14159f); // buffer=" 3.142" Unicode::snprintfFloat(buffer, 20, "%+06.f", 3.14159f); // buffer="+00003" \endcode If more control over the output is needed, see snprintfFloats which can have more than a single "%f" in the string and also supports "*" in place of a number. @warning The format string is internally copied from at char* to a UnicodeChar*. This buffer has a limit of 63 characters, so if the format is longer than 63 characters, the caller must do this copying to prevent an assert from triggering: \code{.cpp} touchgfx::Unicode::UnicodeChar tmpfmt[200]; touchgfx::Unicode::strncpy(tmpfmt, "Very, very, very, very, very, very, very, very, very long format %f", 200); touchgfx::Unicode::snprintfFloats(dst, dstSize, tmpfmt, values); \endcode @see snprintf, snprintfFloats
pointer to the first element in the buffer where the formatted string is placed.