Modules vs. BASIC number format codes
Eike Rathke
erack at redhat.com
Mon Apr 14 15:13:50 UTC 2025
Hi Olivier,
On Thursday, 2025-04-10 10:08:10 -0300, Olivier Hallot wrote:
> For modules we have
> "Number format codes can consist of up to four sections separated by a
> semicolon (;)."
>
> https://help.libreoffice.org/latest/en-US/text/shared/01/05020301.html
>
> But for BASIC we have for function Format()
>
> "A format code can be divided into three sections that are separated by
> semicolons. The first part defines the format for positive values, the
> second part for negative values, and the third part for zero. If you only
> specify one format code, it applies to all numbers."
>
> https://help.libreoffice.org/latest/en-US/text/sbasic/shared/03120301.html
>
> Both <modules> and BASIC share much common formats so is there a reason for
> the difference (to be documented) or this difference is a mistake?
It depends ... if the format code is not (does not contain) one of the
"Predefined format" strings (or maybe other formats specifically
handled) then the general number formatter is used, for which there is
no difference regarding the number of sub-format sections. It is four
possible sub-formats. For "Predefined format" placeholders it is three
possible sub-format sections.
For implementation see basic/source/sbx/sbxscan.cxx SbxValue::Format()
and (via BasicFormatNum()) basic/source/sbx/sbxform.cxx
SbxBasicFormater::BasicFormat()
Eike
--
GPG key 0x6A6CD5B765632D3A - 2265 D7F3 A7B0 95CC 3918 630B 6A6C D5B7 6563 2D3A
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/libreoffice/attachments/20250414/eed912bf/attachment.sig>
More information about the LibreOffice
mailing list