Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

how to find the error in TRIM and String

diedro
Beginner
230 Views

Dear all,

I have a problem with a string.

I have this piece of code:

 write(*,*) LEN(lead_print_name), LEN(TRIM(lead_print_name))

 

the results is:

         100         100

 

However, 

lead_print_name = "gaussian"

 

What could be the possible error in my code?

thanks to everyone

 
0 Kudos
3 Replies
Steven_L_Intel1
Employee
230 Views

How about you show us a small but complete program that demonstrates the problem? My experience is that code snippets often hide the actual source of error.

0 Kudos
diedro
Beginner
230 Views

Dear Steve, Dear all,

thanks a lot. It was a error of mine.

Thanks again for your time. 

In my case there is a selectcase to select the correct words in the name lead_print_name. 

 Unfortunately, no cases were matched and this creates empties spaces.

 

Thanks again

0 Kudos
mecej4
Honored Contributor III
230 Views

diedro wrote:

In my case there is a selectcase to select the correct words in the name lead_print_name. Unfortunately, no cases were matched and this creates empties spaces.

I think that the last part ("creates empty spaces") is incorrect. If no matching clause was found in a SELECT construct, the variable in question would simply retain its previous value. That previous value could be a string of spaces, or it could be anything else, but nothing was created as a consequence of executing the SELECT statement.

0 Kudos
Reply