https://bz.apache.org/ooo/show_bug.cgi?id=128533
Issue ID: 128533
Issue Type: DEFECT
Summary: The BASIC function Str inserts a space before negative
numbers
Product: App Dev
Version: 3.3.0 or older (OOo)
Hardware: PC
OS: Windows, all
Status: CONFIRMED
Severity: Minor
Priority: P5 (lowest)
Component: scripting
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: ---
AOO Help on the Str function:
"The Str function converts a numeric variable,
or the result of a calculation into a string.
Negative numbers are preceded by a minus sign.
Positive numbers are preceded by a space
(instead of the plus sign)."
So for a value of 1 and -1 the Str function shall return,
respectively, ' 1' and '-1' (single quotes here are not part
of the returned strings). Nonetheless the following code
sub test_Str
MsgBox "'" & Str(1) & "'" & Chr(13) &_
"'" & Str(-1) & "'"
end sub
displays:
' 1'
' -1'
Only with Option VBASupport 1
or CompatibilityMode(True)
one gets the _expected_ value, i.e. ' 1' and '-1'
And one more inaccuracy - AOO Help on the Format function:
Syntax:
Format (Number [, Format As String])
Format: String that specifies the format code for the number.
If Format is omitted, the Format function works
like the Str function.
Thus Format(Number) should yield the same result as Str(Number)
The following code:
sub test_Format
MsgBox "'" & Format(1) & "'" & Chr(13) &_
"'" & Format(-1) & "'"
end sub
shows:
'1'
'-1'
--
You are receiving this mail because:
You are the assignee for the issue.