Sprintf formats a formatted string and returns the string. The format can be specified by % followed by a conversion specifier and optionally a flag, width, and precision. Decimal

Specifier Description
%b Binary integer
%d Decimal integer
%x %X Hexadecimal
%e %E Floating point, scientific notation
%f %F Floating point, no exponent notation
%g %G Floating point, %e if the exponent is large, %f otherwise
%s String
%% The character of % itself
Flag Description
+ Signed
- Left justified
0 If it is less than the width, fill it with 0 instead of space (left padding)
Length and Accuracy Description
%f Default length
%9f Length 9
%.2f Accuracy 2
%9.2f length 9 and accuracy 2

Examples

Sprintf("Messages: %d", ToInt(cv.Payload))
Sprintf("Floating point to the second decimal place: %.2f", cv.Payload)

Was this helpful?

Yes No
You indicated this topic was not helpful to you ...
Could you please leave a comment telling us why? Thank you!
Thanks for your feedback.