Help Center
Help CenterFreeBASIC

Operator & (String Concatenation With Conversion)operator

Concatenates two strings, converting non-strings to strings as needed

Operatorsoperatordocumented

Syntax

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

Parameters

NameDescription
lhsThe left-hand side expression to concatenate.
TAny standard data type or user-defined type that can be converted to a standard data type.
rhsThe right-hand side expression to concatenate.
UAny standard data type or user-defined type that can be converted to a standard data type.
VThe resultant string type (varies with operands).

Description


This operator concatenates two expressions. If either of the expressions is 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 String is returned.

This operator can be overloaded to accept user-defined types.

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

Remarks

Usage


result = lhs & rhs

Differences from QB


  • New to FreeBASIC

See also


Example


Dim As String A,C

Dim As Single B

A="The result is: "

B=124.3

C=A & B

Print C

Sleep

Output:
The result is: 124.3

Reference

  • Documented in KeyPgOpConcatConvert.html