- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have CVF 6.6 Professional 6.6A. Why doesn't the character concatenation operator work with character variables. For example, consider the following code:
TEXT1 = ADJUSTL( TEXT1 )
TEXT1 = TRIM( TEXT1 )
TEXT2 = ADJUSTL( TEXT2 )
TEXT2 = TRIM( TEXT2 )
TEXT = TEXT1 // ' ' // TEXT2
Where all three variables were declared as character (256), and text1 and text2 were previously assigned values, then by what I have read in the language reference manual, the final result assigned to TEXT should contain what's in TEXT1, followed by a blank character, followed by what's in TEXT2. However, what actually happens is that TEXT is assigned what's in TEXT1 only. The complier also warns me that this line won't work. Is this behavior in accordance with Fortran 95, or is this a defect of CVF?
TEXT1 = ADJUSTL( TEXT1 )
TEXT1 = TRIM( TEXT1 )
TEXT2 = ADJUSTL( TEXT2 )
TEXT2 = TRIM( TEXT2 )
TEXT = TEXT1 // ' ' // TEXT2
Where all three variables were declared as character (256), and text1 and text2 were previously assigned values, then by what I have read in the language reference manual, the final result assigned to TEXT should contain what's in TEXT1, followed by a blank character, followed by what's in TEXT2. However, what actually happens is that TEXT is assigned what's in TEXT1 only. The complier also warns me that this line won't work. Is this behavior in accordance with Fortran 95, or is this a defect of CVF?
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You should use:
TEXT=TRIM(ADJUSTL(TEXT1))//''//TRIM(ADJUSTL(TEXT2))
The statement:
TEXT1 = TRIM( TEXT1 )
still leaves you with a 256 character string.
Appending a string to the end doesn't contribute to the result because TEXT also has 256 characters
Walter
TEXT=TRIM(ADJUSTL(TEXT1))//''//TRIM(ADJUSTL(TEXT2))
The statement:
TEXT1 = TRIM( TEXT1 )
still leaves you with a 256 character string.
Appending a string to the end doesn't contribute to the result because TEXT also has 256 characters
Walter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thankyou. That was it.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page