D
Domac
What is the difference between "+" and "&" operator when joining strings?
Thanx!
Thanx!
Domac said:What is the difference between "+" and "&" operator when joining strings?
*From:* "Domac" <[email protected]>
*Date:* Thu, 29 Jun 2006 13:51:07 +0200
What is the difference between "+" and "&" operator when joining
strings?
Domac said:What is the difference between "+" and "&" operator when joining strings?
Phill said:With "Option Strict On" - none at all.
With "Option Strict Off" and joining only Strings - none at all.
With "Option Strict Off" and joining Strings and /other/ data types -
the effects can be "interesting" ...
HTH,
Phill W.
Dick said:I use &= in assignment statements all the time. For example:
strHTML &= MonthName(CInt(sMonth), False) & " - " & sYear &
"</h3></center><br>"
Hope this helps...
Dick
Brian said:OK, i see, my mistake. Thanks for the correction.
I quickly tested it out by opening a module and typing:
Sub a()
Dim a As String
a+=a
a&=a
End Sub
The editor separated a+=a into a += a, but it separated a&=a to a& = a
and underlined a& as an error. Which i assumed (incorrectly) that &=
was not supported.
So, perhaps a difference is whether the editor put in that space before
the operator. With = is does, with & it does not. Well, nothing too
important.
Thanx for the correction.
B.
Jay said:Göran
| That is Basic Baggage. The & character once had a meaning at the end of
| a variable name. The interpreter still recognises this, but it doesn't
| work any more.
As Guy suggests whatever& still works in both .NET 1.x & .NET 2.0.
For example:
Dim whatever&
is short hand for:
Dim whatever As Long
For details see:
http://msdn2.microsoft.com/en-us/library/s9cz43ek.aspx
However I don't recommend using it, as only a very small subset of types are
supported...