Programmer Guide > Working with Text > Concatenating Strings
  

Concatenating Strings
The addition operator concatenates strings. For example, the command:
A = 'This is ' + 'a concatenation example.'
PRINT, A
results in the output:
This is a concatenation example.
The following statements build a scalar string containing a list of the names found in the TREES string array separated by commas:
; The list of names. 
NAMES = ''
FOR I = 0, 6 DO BEGIN 
; Add comma before next name.
IF (I NE 0) THEN NAMES = NAMES + ', '
; Add the new name to the end of the list.
NAMES = NAMES + TREES(I)
ENDFOR
; Show the resulting list.
PRINT, NAMES
Running the above statements gives the result:
Beech, Birch, Mahogany, Maple, Oak, Pine, Walnut

Version 2017.0
Copyright © 2017, Rogue Wave Software, Inc. All Rights Reserved.