org.sonar.l10n.delphi.rules.community-delphi.FormatArgumentCount.html Maven / Gradle / Ivy
Why is this an issue?
Passing the wrong number of arguments to a call to System.SysUtils.Format
raises a runtime exception.
Typically, the number of arguments should exactly match the number of format specifiers
in the string. For some complex cases, a different number of arguments is required
-
Width and precision wildcards in floating point format specifiers
(e.g.
%*.*f
) require corresponding arguments
-
Format specifiers with a specified index (e.g.
%1:s
)
can reuse existing arguments or require additional arguments
How to fix it
Ensure that the arguments to the Format
call match the specifiers in the format
string:
Format('%s (class %d) got %.*f percent on the test.', ['Bob', 74.599]);
Format('%s (class %d) got %.*f percent on the test.', ['Bob', 6, 2, 74.599]);
Resources
© 2015 - 2024 Weber Informatics LLC | Privacy Policy