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

            Bug ID: 146590
           Summary: Basic's Str function adding unnecessary blank space
                    before negative numbers
           Product: LibreOffice
           Version: 7.2.2.2 release
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: BASIC
          Assignee: libreoffice-bugs@lists.freedesktop.org
          Reporter: rafael.palma.l...@gmail.com

Running the following code in Basic, the Str function is adding an unnecessary
blank space before a negative number. The extra blank space should be added
only to the positive number.

Sub TestStr
    Print "'" & Str(10) & "'"
    Print "'" & Str(-10) & "'"
End Sub

The code above returns:
' 10'
' -10'

However, running the same code above with Option VBASupport 1, I get the
expected result:
' 10'
'-10'

I do not see a reason why we would need to enable VBA support to get this
result.

This is being caused by the following code:
https://opengrok.libreoffice.org/xref/core/basic/source/runtime/methods.cxx?r=fffc6b40#1476

Which required bCompatibility to be enabled, or else a blank space is added to
the string regardless of it being a positive/negative number.

As a side note, running the code above with Option Compatible does not fix the
problem. Only adding Option VBASupport 1 fixes it. There seems to be some
problem with Basic enabling Option Compatible (see also bug 145753).

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to