Concatenation Operators

As in the previous versions, Visual Basic 2015 still offers concatenation operators: the + and & symbols. The main difference between them is that the + symbol is intended for numeric additions, although it can also work with strings; the & symbol is defined only for strings, and it should be preferred when concatenating strings so that you can avoid possible errors. Listing 4.2 shows an example of concatenation.

LISTING 4.2 Concatenation Operators

Module ConcatenationOperators    Sub ConcatenationDemo()        Dim firstString As String = "Alessandro"        Dim secondString As String = "Del Sole"        Dim completeString As String = firstString & secondString        'The following still ...

Get Visual Basic 2015 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.