<div dir="ltr"><div class="gmail_default" style=""><font face="arial, sans-serif">Hi Olivier, Eike, All,</font></div><div class="gmail_default" style=""><font face="arial, sans-serif"><br></font></div><font face="arial, sans-serif">Thanks, Olivier, for pointing out this documentation discrepancy between the general number format codes and the Basic Format() function regarding the number of sections. And thanks, Eike, for clarifying the current implementation detail that causes this difference (use of SvNumberFormatter vs. the specific handling in SbxBasicFormater for predefined formats).</font><div><font face="arial, sans-serif"><br>This discussion is highly relevant as this exact inconsistency is something we are<span class="gmail_default" style=""></span> actively working to resolve in tdf#143193 - Clean up Basic 'Format' implementation.<br>[Link to the bug: <a href="https://bugs.documentfoundation.org/show_bug.cgi?id=143193">https://bugs.documentfoundation.org/show_bug.cgi?id=143193</a>]</font></div><div><font face="arial, sans-serif"><br>The goal of this task is precisely to refactor SbxValue::Format to remove the legacy SbxBasicFormater (which Eike mentioned) and rely solely on the standard <font color="#741b47">SvNumberFormatter </font>for all applicable cases handled by Basic's Format.</font></div><div><br></div><div><font face="arial, sans-serif">A patch is currently under review ([Link to Gerrit: <span class="gmail_default" style="font-family:"comic sans ms",sans-serif"></span></font><a href="https://gerrit.libreoffice.org/c/core/+/183575">https://gerrit.libreoffice.org/c/core/+/183575</a><font face="arial, sans-serif">]<span class="gmail_default" style="font-family:"comic sans ms",sans-serif">)</span><span class="gmail_default" style="font-family:"comic sans ms",sans-serif">. </span></font>Feedback or review on the patch would be welcome<span class="gmail_default" style="font-family:"comic sans ms",sans-serif"></span><span class="gmail_default" style="font-family:arial,sans-serif"> :)</span></div><div><font face="arial, sans-serif"><br>Once tdf#143193 is merged, the documentation for Basic's Format() function will indeed need updating to reflect the unified behavior, aligning it more closely with the general number formatting rules.</font><div class="gmail_default" style="font-family:comic sans ms,sans-serif"><br></div></div></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Mon, 14 Apr 2025 at 20:44, Eike Rathke <<a href="mailto:erack@redhat.com">erack@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Olivier,<br>
<br>
On Thursday, 2025-04-10 10:08:10 -0300, Olivier Hallot wrote:<br>
<br>
> For modules we have<br>
> "Number format codes can consist of up to four sections separated by a<br>
> semicolon (;)."<br>
> <br>
> <a href="https://help.libreoffice.org/latest/en-US/text/shared/01/05020301.html" rel="noreferrer" target="_blank">https://help.libreoffice.org/latest/en-US/text/shared/01/05020301.html</a><br>
> <br>
> But for BASIC we have for function Format()<br>
> <br>
> "A format code can be divided into three sections that are separated by<br>
> semicolons. The first part defines the format for positive values, the<br>
> second part for negative values, and the third part for zero. If you only<br>
> specify one format code, it applies to all numbers."<br>
> <br>
> <a href="https://help.libreoffice.org/latest/en-US/text/sbasic/shared/03120301.html" rel="noreferrer" target="_blank">https://help.libreoffice.org/latest/en-US/text/sbasic/shared/03120301.html</a><br>
> <br>
> Both <modules> and BASIC share much common formats so is there a reason for<br>
> the difference (to be documented) or this difference is a mistake?<br>
<br>
It depends ... if the format code is not (does not contain) one of the<br>
"Predefined format" strings (or maybe other formats specifically<br>
handled) then the general number formatter is used, for which there is<br>
no difference regarding the number of sub-format sections. It is four<br>
possible sub-formats. For "Predefined format" placeholders it is three<br>
possible sub-format sections.<br>
<br>
For implementation see basic/source/sbx/sbxscan.cxx SbxValue::Format()<br>
and (via BasicFormatNum()) basic/source/sbx/sbxform.cxx<br>
SbxBasicFormater::BasicFormat()<br>
<br>
Eike<br>
<br>
-- <br>
GPG key 0x6A6CD5B765632D3A - 2265 D7F3 A7B0 95CC 3918 630B 6A6C D5B7 6563 2D3A<br>
</blockquote></div><div><br clear="all"></div><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><span style="font-family:monospace"><b>Regards,</b></span></div><div><span style="font-family:monospace;color:rgb(153,0,255)"><b>Devansh</b></span><br></div></div></div>