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

Question about substrings

Intel_C_Intel
Employee
292 Views

The documentations states that for a character string of the form v(e1:e2)

"Both e1 and e2 must be within the range 1,2, ..., len, where len is the length of the parent character string. If e1 exceeds e2, the substring has length zero.

So is it safe to have a substring of length 0? I.e., I have code like:

l=len_trim(string) !where string is all blank

call sub(string(1:L))

where sub is like

subroutine sub(string)

character string*(*)

if (len_trim(string) .gt.0) then

do stuff

endif
end It works, but can it lead to trouble? Do I have to check for this

0 Kudos
0 Replies
Reply