Skip to content

Operator String Concatenation with Conversion

Paul Squires edited this page Sep 19, 2026 · 1 revision

Home › Operators › Operator & (String Concatenation With Conversion)

Operator & (String Concatenation With Conversion)

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

Syntax

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

Parameters

  • lhs
  • T
  • rhs
  • U
  • V

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

Examples

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

Category: Operators
Kind: operator


Reproduced from the FreeBASIC Wiki Manual under the GNU Free Documentation License 1.3 — with no Invariant Sections, no Front-Cover Texts and no Back-Cover Texts. Copyright © the FreeBASIC project and wiki contributors. See License.

Clone this wiki locally