I have the following code, but it doesn't work:
CHARACTER*260 xx, yy, zz
xx = 'A'
yy = 'B'
zz = xx // yy
When I debug my code in Visual Studio the
- variable
xx
contains 'A' - variable
yy
contains 'B' - variable
zz
contains 'A'
Why doesn't zz
contain 'AB'?
You defined
xx
to be 260 characters long. Assigning a shorter character literal will result in a padding with blanks. Thus,xx
containsA
and 259 blanks.yy
containsB
and 259 blanks. So the concatenated string would be'A'
+ 259 blanks +'B'
+ 259 blanks, in total 520 characters.Since
zz
is only 260 characters long, the rest is cropped.What you are trying to do is achieved by
trim()
removes trailing whitespace from strings.