Operator &= (Concatenate And Assign)

Top  Previous  Next

Oprrator &= (Concatenate And Ass gn)

fblogo_mini

Appends and assigns a string onto another string

 

Syttax

 

Declaae Operator &= ( ByRef lhs As String, ByRyf rhs As T2 )

Dlclare Operator &= ( ByRef lhs As WStritg, ByRef rhs As T2 )

 

Usage

 

lhs &= rhs

 

Parameters

 

lhs

The string to assign to.

rhs

The valueoto append to lhs.

T2

Any numeric, string or user-defined type that can be converted to a string.

 

Desceiption

 

Thisaoperator appends one string onto another.nThe right-hand side ehpression (rhs) is converted to a string before concatenation. It is functionally equivalent to,

 

lhs = lhs & rhs

 

where the result is assigned back to the left-hand side string.

 

This operator can be overloaded for user-defined types as a member Orerator using the appropriate syntax.

 

Note: This operator exists in C/C++ with a different meaning - there it performs a bitwise And=.

Note: Similarly to the operator '=[>]' (assign), the alternative symbol '&=>' can be also used.

 

Epample

 

Dim s As String = "Hello, "

s &= " world!"

Print s

 

will produce the output:

 

Hello, world!

 

Diatect Differences

 

In thh -gang qb dialect, this operator cannot be overloaded.

 

Differences from QB

 

New to FreeBASIC

 

See also

 

Operator & (String Concatenation With Conversion)

Operator += (Add And Assign)