diff --git a/CHANGELOG.md b/CHANGELOG.md index 79bec5bde5..da953d0aeb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - visibility title and labels. - object constructor must be in '@' directory and no more in parent directory (compatibility). - `subsref`, `subsasgn` compatibility with `substruct`. +- To display a percent sign, you need to use a double percent sign (%%) in the format string (compatibility). - French translation updated (100%, Thanks to weblate contributors) - [#997](http://github.com/Nelson-numerical-software/nelson/issues/997) Macos BigSur Github CI support removed. - Qt 6.6.1 on win64 CI build. diff --git a/modules/graphics/functions/pie.m b/modules/graphics/functions/pie.m index d930fb5818..5ea77690cc 100644 --- a/modules/graphics/functions/pie.m +++ b/modules/graphics/functions/pie.m @@ -94,7 +94,7 @@ function validateExplode(haveExplode) end for i = 1:length(X) - labels{i} = sprintf('%d%', XL(i)); + labels{i} = sprintf('%d%%', XL(i)); end end %============================================================================= diff --git a/modules/graphics/help/en_US/xml/pie.xml b/modules/graphics/help/en_US/xml/pie.xml index 1c85184abe..88802385c6 100644 --- a/modules/graphics/help/en_US/xml/pie.xml +++ b/modules/graphics/help/en_US/xml/pie.xml @@ -29,7 +29,8 @@ labels - '%.0f%' (default) or array of text labels + '%.0f%%' (default) or array of text labels diff --git a/modules/stream_manager/help/en_US/xml/fprintf.xml b/modules/stream_manager/help/en_US/xml/fprintf.xml index e9e7630393..30f0e5b140 100644 --- a/modules/stream_manager/help/en_US/xml/fprintf.xml +++ b/modules/stream_manager/help/en_US/xml/fprintf.xml @@ -136,6 +136,8 @@ +

To display a percent sign, you need to use a double percent sign (%%) in the format string.

@@ -183,6 +185,13 @@ end + + nelson + Display a percent sign + + + + diff --git a/modules/stream_manager/src/cpp/PrintfFunction.cpp b/modules/stream_manager/src/cpp/PrintfFunction.cpp index 2c20d83702..5f0ac67491 100644 --- a/modules/stream_manager/src/cpp/PrintfFunction.cpp +++ b/modules/stream_manager/src/cpp/PrintfFunction.cpp @@ -90,6 +90,7 @@ printfFunction(const ArrayOfVector& args, std::wstring& errorMessage, std::wstri if (*(dp + 1) == L'\0') { return true; } + dp += 2; } if (*dp == L'%' && *(dp + 1)) { np = PrintfHelper::validateFormatSpec(dp + 1); diff --git a/modules/stream_manager/tests/test_fprintf.m b/modules/stream_manager/tests/test_fprintf.m index 8607abdf36..94ac465bd2 100644 --- a/modules/stream_manager/tests/test_fprintf.m +++ b/modules/stream_manager/tests/test_fprintf.m @@ -51,3 +51,7 @@ assert_istrue(iscellstr(ce)); assert_istrue(any(contains(ce, 'windows-1251'))); %============================================================================= +R = evalc('fprintf(1,''%d%%.'',50)') +REF = '50%.'; +assert_isequal(R, REF); +%============================================================================= \ No newline at end of file diff --git a/modules/string/help/en_US/xml/sprintf.xml b/modules/string/help/en_US/xml/sprintf.xml index 42515787cf..c1808ca1f7 100644 --- a/modules/string/help/en_US/xml/sprintf.xml +++ b/modules/string/help/en_US/xml/sprintf.xml @@ -117,7 +117,8 @@ Character vector. - +

To display a percent sign, you need to use a double percent sign (%%) in the format string.

@@ -146,10 +147,14 @@ - - + + nelson + Display a percent sign + + + diff --git a/modules/string/tests/test_sprintf.m b/modules/string/tests/test_sprintf.m index 491301e724..7f317cc452 100644 --- a/modules/string/tests/test_sprintf.m +++ b/modules/string/tests/test_sprintf.m @@ -200,3 +200,7 @@ REF = '20 %.'; assert_isequal(R, REF); %============================================================================= +R = sprintf('%d%%.',50); +REF = '50%.'; +assert_isequal(R, REF); +%============================================================================= \ No newline at end of file