Official Content

Concatenates two strings, including a separator if desired.

Syntax

Concat(character-expression1, character-expression2, [ ,character-expression3 ] )

character-expression1 + character-expression2 

Where:

character-expression3
    Is the separator between character-expression1 and character-expression2

+ (plus sign)

Type Returned:
Character

Scope

Objects: Procedure, Transaction, Web Panel, Panel, Data Provider
Generators: .NET, .NET Framework, JavaApple, Android, Angular

Description

Returns a String that results from the concatenation of character-expression1 and character-expression2> and separator character-expression3. Trailing blanks of string character-expression1 are truncated. If character-expression3 is not specified, no separator is inserted.

Note: In the iSeries, if the strings character-expression1, character-expression2 or character-expression3 are substituted with functions (substr(), str(), etc), then the returned value is null, because the returned values of these functions are 256-character-long variables.

Samples

LastName  = 'SMITH '
FirstName = 'JOHN '
&FullName  = Concat(FirstName,LastName,' ')

Result: &FullName = 'JOHN SMITH '

In case you want to maintain the trailing blanks in the first parameter, you may change the order of the parameters. For example:

LastName  = 'SMITH'
FirstName = 'JOHN '
&FullName = Concat(,LastName,FirstName)

With the plus sign, the concatenation is very simple:

&FullName  = &Firstname + ' ' + &Lastname

Result: &FullName = 'JOHN SMITH'

See Also

Str function
Substr function

Last update: April 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant