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

2021-07-07 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=143183

--- Comment #4 from Mike Kaganski  ---
(In reply to Olivier Hallot from comment #3)
> Also the "&" format code seems to return the format string itself.
> msgbox Format("ADCDEFGHIJKLMNOPQRSTUVWXYZ1234567890", "")
> msgbox Format(123.456, "")
> msgbox Format("123.456", "")
> 
> all return 

No, the first one returns "ADCDEFGHIJKLMNOPQRSTUVWXYZ1234567890" - the handling
of "&" in printfmtstr is the same as treatment of everything else ("default"
clause in the switch), with the only difference of also modifying position of
the pFmt, which is only used for return value of the function ("the number of
characters used from the format"), which is in fact unused in the only place
where the function is called - hence I didn't mention the "&" in comment 2.

When the string may be converted to number, it is handled as a number, using
different rules.

In general, I suppose we need to drop this "printfmtstr" idiocy, as I suggested
in tdf#143193.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


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

2021-07-07 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=143183

Olivier Hallot  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
 Blocks||80430
 Ever confirmed|0   |1

--- Comment #3 from Olivier Hallot  ---
The printfmtstr extra codes for strings may return unexpected values if not
carefully coded in Basic

msgbox Format("FooBar", "!!abc") '=> "F" (everything after initial "1" is
discarded)
msgbox Format("123.456", "!") '=> return !
msgbox Format("123.456", "!!abc") '=> return !!abc 
msgbox Format("123.abc456", "!!abc") '=> return 1

So, if the string contents is a valid number, the '!' format string return the
format string itself.
otherwise, return the first character of the input string.


Also the "&" format code seems to return the format string itself.
msgbox Format("ADCDEFGHIJKLMNOPQRSTUVWXYZ1234567890", "")
msgbox Format(123.456, "")
msgbox Format("123.456", "")

all return 


Referenced Bugs:

https://bugs.documentfoundation.org/show_bug.cgi?id=80430
[Bug 80430] [META] Documentation gap for new features
-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


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

2021-07-05 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=143183

Mike Kaganski  changed:

   What|Removed |Added

   See Also||https://bugs.documentfounda
   ||tion.org/show_bug.cgi?id=14
   ||3193

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


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

2021-07-04 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=143183

Mike Kaganski  changed:

   What|Removed |Added

 CC||er...@redhat.com

--- Comment #2 from Mike Kaganski  ---
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@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.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


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

2021-07-04 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=143183

--- Comment #1 from Mike Kaganski  ---
There are more special format strings in Basic:

  * "Long Date" ("System long date format" (in fact, depends on LO locale))
  * "Medium Date" ("DD-MMM-YY")
  * "Short Date" ("System short date format" (in fact, depends on LO locale))
  * "Long Time" ("H:MM:SS AM/PM")
  * "Medium Time" (HH:MM AM/PM)
  * "Short Time" (HH:MM)
  * "d" (same as "Short Date")
  * "dd" (same as "Long Date")
  * "t" (H:MM:SS AM/PM)

(see getFormatInfo() and pFormatInfoTable)

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs