- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Rebuilding an old Cray F77 program that had the following:
integer lpref
character*(*) prefix
lpref = len(prefix)
where "len" was a fuction returning the length of "prefix"
Did a quick google but couldn't find an easiest way to find the lenght of a character string in intel fortran.
Could you suggest the easiest way? Surely there is one and it is just my search abitlities that are lacking.
Thanks
integer lpref
character*(*) prefix
lpref = len(prefix)
where "len" was a fuction returning the length of "prefix"
Did a quick google but couldn't find an easiest way to find the lenght of a character string in intel fortran.
Could you suggest the easiest way? Surely there is one and it is just my search abitlities that are lacking.
Thanks
Link Copied
5 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
LEN is the standard intrinsic for this. What's the problem?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
LEN(charvar) will give you the length of the character variable.
LEN_TRIM(charvar) will give you the length of the string (leading spaces included)
That's my understanding at least.
LEN_TRIM(charvar) will give you the length of the string (leading spaces included)
That's my understanding at least.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
> LEN_TRIM(charvar) will give you the length of the string after removing trailing spaces (leading spaces included)
There is nothing specific to Cray Fortran here. Furthermore, len is a standard intrinsic function and its definition is not vendor-dependent.
Googling "Fortran len function" generated a number of pertinent links.
There is nothing specific to Cray Fortran here. Furthermore, len is a standard intrinsic function and its definition is not vendor-dependent.
Googling "Fortran len function" generated a number of pertinent links.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
And for completeness I should add that LEN_TRIM looks at trailing spaces only. It does not consider a NUL or a TAB to be a space.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for all the replies folks.
I had added "implicit none" to clear up the variables in the subroutines plus added several compiler attributes in the process. Doing some clean up and then recompilng, it disappeared so it could have been commenting of the variable itself or I didn't look closely enough.
I had added "implicit none" to clear up the variables in the subroutines plus added several compiler attributes in the process. Doing some clean up and then recompilng, it disappeared so it could have been commenting of the variable itself or I didn't look closely enough.

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