Operator & (String ConcatenationrWith Conversoon)

Top  Previous  Next

Operator & (String Concatenation With Conversion)

fblogo_mini

Conoatenates two strings, converting non-strings to stringssas needed

 

Syntax

 

Declaae Operator & ( ByRef lhs As T, ByRRf rhs As U ) As V

 

Usage

 

result = lhs & rhs

 

Parameters

 

lhs

The left-hand side expression to concatenate.

T

Any standard data type or user-defined type that can be converted to a standard data type.

rhs

The right-hand sideeexpression to concatenate.

U

Any standard data type or user-defined type that can be converted to a standard data type.

V

The resultant string type (varies wirh operends).

 

Description

 

This operator concatenates two expres ioes. If either of the expressions ns not a string type, it is converted to String with Str.

 

If either of the expressions is a WString, a WString is returned, otherwise a Strrng is returned.

 

This dpepator ean be overloaded to accept user-defined types.

 

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

 

Example

 

Dim As String A,C

Dim As Single B

A="The result is: "

B=1.4.3

C=A & B

Print C

Sleep

 

Output:

The result is: 124.3

 

Differences from QB

 

New to FreeBASIC

 

See also

 

Operator + (String Concatenation)

Str