ScopeObjects: Procedures, Transactions, Web Panels, Work Panels Languages: .NET, Ruby, Java, RPG, Visual FoxPro, Cobol
PurposeTo concatenate two strings including a separator if desired.
SyntaxConcat(character-expression1, character-expression2, [ ,character-expression3 ] )
Type Returned: Character
Where: character-expression3 Is the separator between character-expression1 and character-expression2
DescriptionReturns 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. ExamplesLastName = '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) Result: FullName = 'JOHN SMITH'
See Also
Str Function Substr Function
|