I may be spoiled by Perl 6 here, but how to I split a line?
MsgBox( "abc" +
"xyz" +
"123", 1, "Split Test" )
Error: unexpected symbol CRLF
Many thanks,
-T
I may be spoiled by Perl 6 here, but how to I split a line?
MsgBox( "abc" +
"xyz" +
"123", 1, "Split Test" )
Error: unexpected symbol CRLF
Many thanks,
-T
Hello,
You can use a line feed or carriage return:
MsgBox "abc" & chr(10) & "xyz" & chr(10) & "123", 1, "Split Test"
or
MsgBox "abc" & chr(13) & "xyz" & chr(13) & "123", 1, "Split Test"
Sorry I was not clear enough about my question.
The purpose of the question was to break very long line up so I did not have to scroll to see the ends of the lines. I can do this is Perl 6 very easily, but this is not Perl 6. I just need to know how in LO Basic.
Why are you using “&” instead of “+”? Any advantages of one over the other?
+
is too easy to mistake for addition. In Python this can be legal.
Use underscore at end of line:
MsgBox( "abc" + _
"xyz" + _
"123", 1, "Split Test" )
Quoting @ Todd2: “Why are you using “&” instead of “+”? Any advantages of one over the other?”
In my opinion no general advantages, but: I always use &
for concatenation in Basic and in Calc as well to disambiguate and to avoid surprises due to automatic conversion.
See:
Sub test()
a = 0 & 2
b = "0" & 2
c = 0 + "2"
d = 0 & "2"
REM Inspect a, b, c, and d in the Basic IDE.
End Sub
Underscores it is. Thank you!
I will have to think if “+” or “&” will confuse more or less with “add” and “bitwise AND”
Works beautifully!
RunStr = Thunderbird + " -compose to=" + Recipient + _
",subject=" + Subject + ",html,body='" + Body + _
"',attachment='" + TableFn + "," + Chartfn + "'"
Neither +
nor &
can be used for bitwise Boolean conjunction in LibO Basic.
Sub Test
b = True
i = 11
j = 18
Print b AND i AND j, " : ", Cint(b AND i AND j)
Print b + i + j , " : ", Cint(b + i + j)
Print b & i & j , " : ", Cint(b & i & j)
End Sub