[Libreoffice-bugs] [Bug 143183] Format Basic function needs better description of its 'format' argument

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Sun Jul 4 21:09:53 UTC 2021


https://bugs.documentfoundation.org/show_bug.cgi?id=143183

Mike Kaganski <mikekaganski at hotmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |erack at redhat.com

--- Comment #2 from Mike Kaganski <mikekaganski at hotmail.com> ---
OMG, how convoluted is it all.
There is a special processing in Basic for text input.

* "!" in the first position of format string means "take first character only
(and ignore the rest of both input string, and of format string)":

> Format("FooBar", "!!abc") => "F" (everything after initial "1" is discarded)

* "\" in the first position of format string means "starting from this, start
outputting character by character from the input string, until another "\" is
found, then break":

> Format("FooBar", "\.!?\abc") => "FooBa" (5 character output: one for each "\",
>                                       ".", "!", "?", and "\").

* Everything else in the format string just means "output the input string
verbatim".
This effectively disables normal format string handling for strings that can't
convert to text - so e.g. this doesn't produce an expected result:

> Format("BAZ", "foo at bar") => "BAZ", not expected "fooBAZbar", nor
>                             "fooBbazAR", as VBA gives

IIUC, VBA doesn't have such a strange thing. Where does this come from? Even
https://wiki.openoffice.org/w/images/c/c1/BasicGuide_OOo3.2.0.pdf doesn't
mention those strange things. Should we just drop that special processing?

See printfmtstr in basic/source/sbx/sbxscan.cxx

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20210704/8c90524c/attachment.htm>


More information about the Libreoffice-bugs mailing list